How to change the default download path to download jquery file

I implemented a plugin to load a jQuery file with a frame structure that was relatively straight forward as instructed.

https://github.com/blueimp/jQuery-File-Upload

My question specifically refers to the PHP class, when loading images is loaded into my frames folder (where the php script is executed). I want to know if there is a way to set the path where images will be uploaded.

This is the class in question.

https://github.com/blueimp/jQuery-File-Upload/blob/master/server/php/UploadHandler.php

It is included in the jQuery file download repository.

+4
source share
4 answers

You can do this in two ways: 1 .. by changing line 40 on the server /php/UploadHandler.php and place the directory you want

'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/', 

2 .. adding the dir parameter to load when initializing the class

 $options = array ('upload_dir' => dirname(__FILE__) . '/uploaddir/'); $upload_handler = new UploadHandler($options); 
+11
source

Add these parameters to the UploadHandler () function. Remember to add "/" at the end of the path.

 $upload_handler = new UploadHandler(array( 'upload_dir' => '/Your/absolute/upload/folder/path/', 'upload_url' => '/url/of/above/path/', 'script_url' => '/url/of/uploadhandler/script', 'accept_file_types' => '/\.(jpe?g|png)$/i' )); 
+2
source

I found by changing the path located in UploadHandeler.php on lines 40 and 41, this changed the specified path.

0
source

You can override the callback function according to

 $('#fileupload').fileupload({ add: function (e, data) { var jqXHR = data.submit() .success(function (result, textStatus, jqXHR) {/* ... */}) .error(function (jqXHR, textStatus, errorThrown) {/* ... */}) .complete(function (result, textStatus, jqXHR) {/* ... */}); } }); 

In the above example, it just executes the submit form.

0
source

Source: https://habr.com/ru/post/1499273/


All Articles