Closed hezhez closed 8 years ago
Can you post your code?
Thanks for the quick reply, sure -
Just before the end of uploader.php code - (Line 273) - $this->savedFile = $this->uploadDir . $this->fileName;
i've added this -
$photoFormat = substr($this->fileName, strrpos($this->fileName, '.')+1); $targetFile = rand_string(7,'') . '.' . $photoFormat;
(rand_string is the random function name)
and the new name($targetFile) i want to output in the response of "onComplete".
Thanks !
This needs to be done in your upload handler script, not in the FileUpload class in Uploader.php.
Can you post the code you're using to handle the file upload?
Hi !
Got the problem solved, i'm outputting the new file in file_upload.php -
echo json_encode(array('success' => true, 'uploadedFile' => 'upload_files/'.$targetFile
));`
Thanks for the kind help !
Hi,
I've wrote a addon code that manipulate with the uploaded file name (Make random name for each file on the uploader.php), how can i transfer it to client side ?
I've tried changing - $newFileName, but the the "filename response" i get the original file name.
How can i transfer the new name from the uploader.php to the frontend call back ?
Thanks !