/*
  *  Jirafeau, your web file repository
- *  Copyright (C) 2012  Jerome Jutteau <j.jutteau@gmail.com>
+ *  Copyright (C) 2015  Jerome Jutteau <j.jutteau@gmail.com>
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU Affero General Public License as
     alert ('Sorry, upload failed');
 }
 
-function classic_upload (url, file, time, password, one_time)
+function classic_upload (url, file, time, password, one_time, upload_password)
 {
     var req = new XMLHttpRequest ();
     req.upload.addEventListener ("progress", upload_progress, false);
         form.append ("key", password);
     if (one_time)
         form.append ("one_time_download", '1');
+    if (upload_password.length > 0)
+        form.append ("upload_password", upload_password);
+
     req.send (form);
 }
 
 var async_global_time;
 var async_global_transfering = 0;
 
-function async_upload_start (url, max_size, file, time, password, one_time)
+function async_upload_start (url, max_size, file, time, password, one_time, upload_password)
 {
     async_global_transfered = 0;
     async_global_url = url;
         form.append ("key", password);
     if (one_time)
         form.append ("one_time_download", '1');
+    if (upload_password.length > 0)
+        form.append ("upload_password", upload_password);
+
     req.send (form);
 }
 
             document.getElementById('file_select').files[0],
             document.getElementById('select_time').value,
             document.getElementById('input_key').value,
-            document.getElementById('one_time_download').checked
+            document.getElementById('one_time_download').checked,
+            document.getElementById('upload_password').value
             );
     }
     else
             document.getElementById('file_select').files[0],
             document.getElementById('select_time').value,
             document.getElementById('input_key').value,
-            document.getElementById('one_time_download').checked
+            document.getElementById('one_time_download').checked,
+            document.getElementById('upload_password').value
             );
     }
 }