码迷,mamicode.com
首页 > Web开发 > 详细

使用ajaxfileupload.js实现上传文件功能

时间:2017-01-04 18:55:01      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:ddd   file   class   type   cli   实现   let   nbsp   element   

                    <div class="pictureList">
                        <div class="pictureItem" id="uploadItem">
                            <div class="pictureDiv">
                                <span class="commonSprite LAddWhiteBtn" onclick="triggeruploadPicture()"></span>
                                <p class="tipP">将你要上传的图片拖至此区域</p>
                                <input type="file" class="uploadPicture" onchange="uploadPicture(this)" name="Picture_path" id="Picture_path" accept="image/png,image/jpg,image/jpeg" />
                            </div>
                            <span class="uploadSpan" onclick="triggeruploadPicture()">点击上传</span>
                        </div>
                    </div>
function triggeruploadPicture() {
    $(".uploadPicture").trigger("click");
}
function uploadPicture(obj) {
    var file = $(obj).attr("id");
    $.ajaxFileUpload({
        url: ‘../../Ajax/Common/DocumentCommon.ashx?type=AddDocumentImage‘,
        //type: ‘post‘,
        timeout: 60000,
        secureuri: false,
        fileElementId: file, //file控件id
        dataType: ‘json‘,
        success: function (data, status) {
            alert(data.Msg);
            if (data.Success) {

            }
        },
        complete: function (status) { //请求完成后最终执行参数

        }
    });
}

 

使用ajaxfileupload.js实现上传文件功能

标签:ddd   file   class   type   cli   实现   let   nbsp   element   

原文地址:http://www.cnblogs.com/justqi/p/6249586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!