我正在使用http://filedropjs.org/#jquery实现一个文件删除功能到我的网页。
以下是文档中的示例代码:
$('<div><p>Drop something here...</p></div>')
.appendTo(document.body)
.filedrop()
.on('fdsend', function (e, files) {
// Occurs when FileDrop's 'send' event is initiated.
$.each(files, function (i, file) {
file.sendTo('upload.php')
})
})
.on('filedone', function (e, file) {
// Occurs when a File object has done uploading.
alert('Done uploading ' + file.name + ' on ' + this.tagName)
})如何读取服务器对“filedone”的响应?对象e或文件似乎不包含它(用JSON.stringify检查)。我希望upload.php重命名和保存文件,并将新的文件名发送回网页。
发布于 2014-09-15 07:32:55
好的,这可以通过将xhr对象添加到“filedone”函数中来实现:
.on('filedone', function (e, file, xhr) {
var serverResponse = xhr.responseText;
}https://stackoverflow.com/questions/25601275
复制相似问题