jquery文件使用blueImp脚本上传并将结果写入db

时间:2014-11-06 21:44:47

标签: php jquery html jquery-file-upload blueimp

我正在尝试通过jquery将文件上传到我的服务器,一旦上传完成,就将文件名写入某个地址的数据库。

我有脚本工作,因为它上传文件给dir,我从这里得到:     File Uploader

我甚至不知道从哪里开始为db write编写代码。

我假设我需要在函数处理的某个点执行ajax调用。这是basic.html上的功能吗?

$(function () {
// Change this to the location of your server-side upload handler:
var url = window.location.hostname === 'blueimp.github.io' ?
            '//jquery-file-upload.appspot.com/' : 'fileUploader/server/php/';
$('#fileupload').fileupload({
    url: url,
    dataType: 'json',
    done: function (e, data) {
        $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
    });
 },

    progressall: function (e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progress .progress-bar').css(
            'width',
            progress + '%'
        );
},
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');

});

或其他地方?

0 个答案:

没有答案
相关问题