NutzCN Logo
问答 ajaxFileUpload 获取不到 file
发布于 2492天前 作者 qq_e79520c3 2055 次浏览 复制 上一个帖子 下一个帖子
标签:

@At("/uploadPhotos") @Ok("json") @AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" }) public void uploadPhotos(HttpServletRequest req,HttpServletResponse response,@Param("picsource") File f) throws IOException, ServletException{ String picflag = req.getParameter("picsource"); ----------------------------------------------------------- @At("/uploadPhotos") @Ok("json") @AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp" }) public void uploadPhotos(HttpServletRequest req,HttpServletResponse response,@Param("picsource") File f) throws IOException, ServletException{ String picflag = req.getParameter("picsource"); ----------------------------------------------------- var contentHTML= "<div class='clearfix marker-upload marker-upload-bc'><div class='left'>"; contentHTML += "<div class='title clearfix'><label>标题</label>"; contentHTML += "<input id = 'titlePopup' type='text' name='' onkeyup='checkCount(this)' placeholder='请输入标题' onfocus='this.placeholder=\"请输入标题\"' onblur='this.placeholder=\"标题不能为空\"'>"; contentHTML += "<div class='count'><span class='current'>0</span>/<span class='total'>20</span></div>"; contentHTML += "</div><div class='descript clearfix'><label>描述</label>"; contentHTML += "<textarea id = 'desPopup' type='text' name='' onkeyup='checkCount(this)' placeholder='请输入描述'></textarea>"; contentHTML += "<div class='count'><span class='current'>0</span>/<span class='total'>50</span></div>"; contentHTML += "</div><div class='buttons'>"; contentHTML += "<input class='button' type='button' value='重标' onclick = 'restMeasure("+markerType+")'>"; contentHTML += "<input class='button' type='button' value='取消' onclick = 'cancelDistantsPopup()'>"; contentHTML += "<input class='button' type='button' value='保存' onclick = 'saveMarkerData(vectorMeasure,"+markerType+")'>"; contentHTML += "</div></div><form method='post' id='imgformForMarker' ><div class='right'><input id = 'picsource' type='file' class = 'file'>"; contentHTML += "<img src='../assets/img/icon_upload.png'></div></form></div>";
3 回复
function uploadMethod(){
    $.ajaxFileUpload({ 
        url : "../platform/RTS/result_marker/uploadPhotos", 
        secureuri : false, 
        fileElementId:'picsource',//原单上传使用方法 
       // fileElementId :['uploadfile1','uploadfile2','uploadfile3','uploadfile4','uploadfile5'] //传入需要上传的多个file的id即可
        dataType : 'json', 
        success : function(data) {      
            var data1=eval("("+data+")");
            if (data1.result == 0) { 
                alert(data1.resultdata);
            } else { 
                alert("上传失败!");
            } 
        } 

    });
}

@Param("picsource") File f 这个 不知道 picsource 应该是什么

弄好了,就是@Param("picsource") 的问题,

添加回复
请先登陆
回到顶部