Rodolfo said:Clean the var, is the obvious fix.
Hi,
please tell me where to clean the var - my fix if in pic to upload is a blank - in class.uploade.php:
search for:
Code:
$destination = $this->img_upload_path.'temp_'.$this->source["name"];
Code:
$destination = str_replace(' ', '_', $destination);
for me I replace a blank widh underscore.
and 2nd search for (in function randomFile() ):
Code:
$folder = ($folder == '') ? './' : $folder;
Code:
$original_name = str_replace(' ', '_', $original_name);
I replace
Code:
$image_uploaded_path = $this->randomFile($this->img_upload_path, $this->extension);
Code:
$image_uploaded_path = $this->randomFile($this->img_upload_path, $this->extension, $this->source["name"]);
because I make my thing to keep the original filename in the function randomFile()
If there is uploaded a file with the same name and if someone wish not to create a file with a random number but like
origname_1.jpg,
origname_2.jpg
...
then you can do this in function randomFile():
Code:
private function randomFile($folder = '', $extension = '', $original_name = '')
{
$folder = trim($folder);
$folder = ($folder == '') ? './' : $folder;
$original_name = str_replace(' ', '_', $original_name);
$purname = substr($original_name,0,strpos($original_name,"."));
$filepath = $folder . $purname .'.'. $extension;
$t = 0;
while(file_exists($filepath)) {
$filepath = $folder . $purname ."_$t.". $extension;
$t++;
}
return $filepath;
}
This works with version 2.0.18 and class.upload.php 1.8