diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-06-04 22:59:18 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-06-04 22:59:18 +0200 |
commit | 153d8fec30af510cb542db180f1192675ef9f029 (patch) | |
tree | 633677d5d1433f8b80ef4893bfe566ce0f2dcee2 /files | |
parent | b0476bf1745b58e1b4802223902212a274bc19e1 (diff) | |
download | nextcloud-server-153d8fec30af510cb542db180f1192675ef9f029.tar.gz nextcloud-server-153d8fec30af510cb542db180f1192675ef9f029.zip |
fix file actions for newly uploaded files
Diffstat (limited to 'files')
-rw-r--r-- | files/ajax/upload.php | 2 | ||||
-rw-r--r-- | files/js/files.js | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/files/ajax/upload.php b/files/ajax/upload.php index 0939ad0d097..effee0c03c1 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -21,7 +21,7 @@ if(!empty($dir)) $dir .= '/'; $target='/' . stripslashes($dir) . $fileName; if(strpos($dir,'..') === false){ if(OC_FILESYSTEM::fromUploadedFile($source,$target)){ - echo json_encode(array( "status" => "success")); + echo json_encode(array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target))); exit(); } } diff --git a/files/js/files.js b/files/js/files.js index 2e95a7881ef..0172ab1b1a9 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -127,13 +127,21 @@ $(document).ready(function() { }) $('#file_upload_submit').click(function(){ - $('#file_upload_form').submit(); var name=$('#file_upload_filename').val(); if($('#file_upload_start')[0].files[0] && $('#file_upload_start')[0].files[0].size>0){ var size=humanFileSize($('#file_upload_start')[0].files[0].size); }else{ var size='Pending'; } + $('#file_upload_target').load(function(){ + var response=jQuery.parseJSON($('#file_upload_target').contents().find('body').text()); + //set mimetype and if needed filesize + $('tr[data-file="'+name+'"]').attr('data-mime',response.mime); + if(size=='Pending'){ + $('tr[data-file='+name+'] td.filesize').text(response.size); + } + }); + $('#file_upload_form').submit(); var date=new Date(); var uploadTime=formatDate(date); FileList.addFile(name,size,uploadTime); |