【发布时间】:2012-07-12 01:08:27
【问题描述】:
我正在尝试实现 Blueimp jQuery 文件上传器 并且在我的基于 PHP 的网站上运行它时遇到了令人沮丧的事情。
我的主要问题是 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});
}
});
});
});
百万感谢..
【问题讨论】:
标签: php javascript jquery ajax blueimp