I am struggling to update the Jquery file upload plugin so when you upload a file it just overwrites an existing file with the same name instead of renaming it with an upcount.
I have applied the change covered in this link: https://github.com/blueimp/jQuery-File-Upload/issues/1965
but I can't seem overwrite this plugin to get this working?
there's an existing open question not yet answered here: jQuery File Upload by bluimp, how to replace instead of renaming
any guidance on this would be much appreciated.
If you using UploadHandler.php that is exists in the wiki it's simple. In the get_file_name method you should replace this line:
return $this -> get_unique_filename($this -> trim_file_name($name, $type, $index, $content_range), $type, $index, $content_range);
with this:
return $this -> trim_file_name($name, $type, $index, $content_range);
2016 UPDATE to MKoosej's fix! In UploadHandler.php → protected function get_file_name ... replace
return $this->get_unique_filename(
$file_path,
$this->fix_file_extension($file_path, $name, $size, $type, $error,
$index, $content_range),
$size,
$type,
$error,
$index,
$content_range
);
with
return $this -> trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With