Hi !
I rename the file after the upload .
How can I force a refresh of the file list ?
Thanks
Andrei
May 30, 2016, 10:34am
#2
Hi
first modify your response, for example:
print_r(json_encode(array(
"state" => true,
"name" => $filename,
"extra" => array(
"name" => "new_filename.jpg" // <-- new name, will be set in list after upload
)
)));
then on client side:
myVault.attachEvent("onUploadFile", function(data, extra){
myVault.list.updateFileNameSize(data.id, {name: extra.name});
});
Hi Andrei !
I modified upload.php and the client side
if (@$_REQUEST[“mode”] == “html5” || @$_REQUEST[“mode”] == “flash”) {
if (@$_REQUEST[“zero_size”] == “1”) {
$filenameold = @$_REQUEST[“file_name”];
if ($dt==‘3’)
$filename=‘test.pdf’;
file_put_contents(“uploaded/”.$filename, “”); // IE10,IE11 zero file fix
} else {
$filenameold = $_FILES["file"]["name"];
if ($dt=='3')
$filename='test.pdf';
move_uploaded_file($_FILES["file"]["tmp_name"],"uploaded/".$filename);
}
//
header("Content-Type: text/json");
print_r(json_encode(array(
"state" => true,
"name" => $filenameold,
"extra" => array(
"name" => "$filename"
)
)));
die();
}
client side
myVault.attachEvent(“onUploadComplete”, function(data, extra){
myVault.list.updateFileNameSize(data.id, {name: extra.name});
…
unfortunately I get this error
TypeError: extra is undefined
myVault.list.updateFileNameSize(data.id, {name: extra.name});
Upload_handler.php response is
but firebug for data show
data [Object { id=“39”, size=776825, lastModifiedDate=Date, altri elementi…}]
0 Object { id=“39”, size=776825, lastModifiedDate=Date, altri elementi…}
id “39”
name undefined
size 776825
lastModifiedDate Date {Mon Jun 09 2014 10:21:58 GMT+0200 (CEST)}
serverName “06-042_OpenGIS_Web_Map_S…ation_Specification.pdf”
uploaded true
error false
length 1
where am I doing wrong ? Thanks for your attention
Product Name: dhtmlxVault
Version: 2.4.1
Edition: Standard
Andrei
May 30, 2016, 2:40pm
#4
should be onUploadFile instead of onUploadComplete