fix file actions for newly uploaded files

remotes/origin/stable
Robin Appelman 14 years ago
parent b0476bf174
commit 153d8fec30
  1. 2
      files/ajax/upload.php
  2. 10
      files/js/files.js

@ -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();
}
}

@ -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);

Loading…
Cancel
Save