diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-16 01:06:24 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-16 01:06:24 -0700 |
commit | 46f59b165e5bd1908509e8a62b67bf983cfd6224 (patch) | |
tree | 0de426136cd0050eb3f1f8249bafeb0614f8af2d /apps/files | |
parent | c20f01bbf0a1fe00efcdbd01898cdbdf76aafcb0 (diff) | |
parent | 7854cf04eec68da83655a819f081d2f2e12f607b (diff) | |
download | nextcloud-server-46f59b165e5bd1908509e8a62b67bf983cfd6224.tar.gz nextcloud-server-46f59b165e5bd1908509e8a62b67bf983cfd6224.zip |
Merge pull request #4838 from owncloud/refactor_upload_js
refactor upload js & html to always use only js to fill form data
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/file-upload.js | 20 | ||||
-rw-r--r-- | apps/files/templates/index.php | 12 |
2 files changed, 13 insertions, 19 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 970aad1f978..aeb2da90d5f 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -46,6 +46,15 @@ $(document).ready(function() { $('#uploadprogresswrapper input.stop').show(); } }, + submit: function(e, data) { + if ( ! data.formData ) { + // noone set update parameters, we set the minimum + data.formData = { + requesttoken: oc_requesttoken, + dir: $('#dir').val() + }; + } + }, /** * called after the first add, does NOT have the data param * @param e @@ -141,15 +150,8 @@ $(document).ready(function() { $('#uploadprogressbar').fadeOut(); } }; - var file_upload_handler = function() { - $('#file_upload_start').fileupload(file_upload_param); - }; - - - - if ( document.getElementById('data-upload-form') ) { - $(file_upload_handler); - } + $('#file_upload_start').fileupload(file_upload_param); + $.assocArraySize = function(obj) { // http://stackoverflow.com/a/6700/11236 var size = 0, key; diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 09e351d4ea8..bd991c3fcb0 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -15,26 +15,18 @@ </div> <div id="upload" class="button" title="<?php p($l->t('Upload') . ' max. '.$_['uploadMaxHumanFilesize']) ?>"> - <form data-upload-id='1' - id="data-upload-form" - class="file_upload_form" - action="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" - method="post" - enctype="multipart/form-data" - target="file_upload_target_1"> <?php if($_['uploadMaxFilesize'] >= 0):?> <input type="hidden" name="MAX_FILE_SIZE" id="max_upload" value="<?php p($_['uploadMaxFilesize']) ?>"> <?php endif;?> <!-- Send the requesttoken, this is needed for older IE versions because they don't send the CSRF token via HTTP header in this case --> - <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken"> <input type="hidden" class="max_human_file_size" value="(max <?php p($_['uploadMaxHumanFilesize']); ?>)"> <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> - <input type="file" id="file_upload_start" name='files[]'/> + <input type="file" id="file_upload_start" name='files[]' + data-url="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" /> <a href="#" class="svg"></a> - </form> </div> <?php if ($_['trash'] ): ?> <div id="trash" class="button" <?php $_['trashEmpty'] ? p('disabled') : '' ?>> |