1
我试图实现Blueimp jQuery文件上传 ,并有一个令人沮丧的时间使它在我的基于PHP的网站中工作。如何在PHP中使用Blueimp jQuery文件上传器?
我的主要问题是使用AJAX。 我想要做的就是上传后,
- 它会重定向到(比方说)
abc.php
。 - 上传后(重定向页面之前),我想将文件名保存到MySQL数据库。
我知道如何用PHP处理数据库,但不知道我不能放置我的PHP代码。
因为我想我需要改变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});
}
});
});
});
感谢百万的第一个问题..