I'm trying to implement the Blueimp jQuery file uploader and am having a frustrating time making it work in my PHP-based site.
My main problem is with AJAX. What I want to do is after uploading,
abc.php
. I know how to handle database with PHP but don't know where I can't put my PHP codes.
For the first problem I guess I need to change main.js
$(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload();
// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
);
// Load existing files:
$('#fileupload').each(function () {
var that = this;
$.getJSON(this.action, function (result) {
if (result && result.length) {
$(that).fileupload('option', 'done')
.call(that, null, {result: result});
}
});
});
});
Thanks in million..
To do a redirect you might be better just submitting the form and handling all via PHP, except you lose the progress indicator I guess.
Otherwise, if I have understood you properly, you just use the callback functions to perform a javascript redirect on completion of upload. You just add options to one of the methods such as:
$('#fileupload').fileupload({
done: function (e, data) {
// Do redirect using either href or replace method
// similar behavior as clicking on a link
window.location.href = "/abc.php";
}
});
See this answer about redirects: How to redirect to another webpage in JavaScript/jQuery?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.