jQuery-File-Upload
The basic version has the advantage of not being overloaded with libraries and above all is much easier to import into an already-created website.
Libraries
Setting up
jQuery File Upload Example
If we start from this file, we will find that everything works properly. Unfortunately when we want to retrieve information in the done callback, on Internet Explorer, we will not receive anything usable.
The solution to this problem is to go through forceIframeTransport. It is possible to change this option in the jqueryfileupload.js library. We must then also indicate the redirect that should send us to the result.html file.
Set the following option to true to force iframe transport uploads:
forceIframeTransport: true,
Set the following option to the location of a redirect url on the
origin server, for cross-domain iframe transport uploads:
redirect: http://www.votreurl.com/result.html?%s,"%s indicates where the parameters will be, so it’s important not to forget it.
Retrieving information
http://www.votreurl.com/result.html?%7B%22files%22%3A%5B%7B%22name%22%3A%22Chrysanthemum%20%284%29.jpg%22%2C%22size%22%3A879394%2C%22type%22%3A%22image%5C%2Fjpeg%22%2C%22url%22%3A%22http%3A%5C%2F%5C%2Fwww.votreurl.com/%5C%2Fforum%5C%2Ffiles%5C%2FChrysanthemum%2520%25284%2529.jpg%22%2C%22thumbnail_url%22%3A%22http%3A%5C%2F%5C%2Fwww.votreurl.com/%5C%2Fforum%5C%2Ffiles%5C%2Fthumbnail%5C%2FChrysanthemum%2520%25284%2529.jpg%22%2C%22delete_url%22%3A%22http%3A%5C%2F%5C%2Fwww.votreurl.com/%5C%2Fforum%5C%2F%3Ffile%3DChrysanthemum%2520%25284%2529.jpg%22%2C%22delete_type%22%3A%22DELETE%22%7D%5D%7DjQuery Iframe Transport Plugin Redirect Page
"Files"[{"name":"Chrysanthemum (4).jpg","size":879394,"type":"image/jpeg","url":"http://votreurl.com/files/Chrysanthemum%20%284%29.jpg","thumbnail_url":"http://votreurl.com/files/thumbnail/Chrysanthemum%20%284%29.jpg","delete_url":"http://www.votreurl.com/?file=Chrysanthemum%20%284%29.jpg","delete_type":"DELETE"}]:If you have all that, then from your base script you just need to parse this information in JSON and do whatever you want with it
fileupload button
$('#fileupload').fileupload ()
add: function (e, data)
data.submit(;
},
done: function (e, data)
console.log ('done');
getting the url of the images
var urlImage - "";
var result - $( 'pre', data.result).text();
if (result! ' null '$.trim( result)'!
var obj - JSON.parse(result);
var urlImage - obj.files[0];
urlImage - urlImage.url;
}
('#messagePict').remove();
},
progressall: function (e, data)
console.log ('progressing');
}
});