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,
- it'd redirect to (let's say)
abc.php
. - after uploading (before redirecting page), I want to save the file name to MySQL database.
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..