jqueryfile-uploadblueimp

Jquery BlueImp how to change filename before upload?


Is it possible to change the filename of the file being uploaded via jquery blueimp?


Solution

  • require('UploadHandler.php');
    class CustomUploadHandler extends UploadHandler {
        protected function trim_file_name($file_path, $name, $size, $type, $error, $index, $content_range) {
                $name = 'First_' . microtime(true);
                $name = str_replace('.', '', $name);
                return $name;
            }
    }
    
    $upload_handler = new CustomUploadHandler();

    In your custom file index.php initialize this function of UploadHandler.php