2016-09-29 23:30:06,910 org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:183) DEBUG - Select Html4 Form upload parser --> /ueditor/bd/uploadimage
2016-09-29 23:30:06,911 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:39) DEBUG - FastUpload : /ueditor/bd/uploadimage
2016-09-29 23:30:06,911 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:54) DEBUG - info created
2016-09-29 23:30:06,912 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:60) DEBUG - Params map created - 0 params
2016-09-29 23:30:06,913 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:77) DEBUG - boundary:
------WebKitFormBoundarySbDqa0bAziBRsyAQ
2016-09-29 23:30:07,035 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:100) DEBUG - skip first boundary
2016-09-29 23:30:07,036 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:111) DEBUG - Reading...
2016-09-29 23:30:07,037 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) DEBUG - Upload File info: FilePath=[97N58PICFK8_1024.jpg],fieldName=[Filedata]
2016-09-29 23:30:07,038 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:137) DEBUG - Upload Info: name=97N58PICFK8_1024.jpg,content_type=image/jpeg
2016-09-29 23:30:07,154 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:231) DEBUG - ...Done 114123 bytes readed
2016-09-29 23:30:07,157 com.yunou.mvc.LogTimeProcessor.process(LogTimeProcessor.java:24) DEBUG - [POST]URI=/ueditor/bd/uploadimage 254ms
2016-09-29 23:31:03,081 org.nutz.mvc.impl.ActionInvoker.getActionChain(ActionInvoker.java:87) DEBUG - Path=[/upload/image/] available methods[POST] but request [GET], using the wrong http method?
2016-09-29 23:31:03,082 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:110) DEBUG - Search mapping for path=/upload/image/ : NOT Action match
2016-09-30 07:57:59,483 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/robots : IndexModule.news(IndexModule.java:61)
2016-09-30 07:57:59,484 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'siteService'<class com.yunou.services.SiteService>
2016-09-30 07:57:59,626 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM t_site WHERE id=?
方法
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:imageUpload"})
@POST
@At
@Ok("json")
//AdaptorErrorContext必须是最后一个参数
public Object image(@Param("Filedata") TempFile tf, HttpServletRequest req, AdaptorErrorContext err) {
try {
if (err != null && err.getAdaptorErr() != null) {
return Result.error(1,"upload.notvalid");
} else if (tf == null) {
return Result.error("upload.empty");
} else {
String p = Globals.AppRoot;
String f = Globals.AppUploadPath + "/image/" + DateUtil.format(new Date(), "yyyyMMdd") + "/" + R.UU32() + tf.getSubmittedFileName().substring(tf.getSubmittedFileName().indexOf("."));
Files.write(new File(p + f), tf.getInputStream());
return Result.success("upload.success", Globals.AppBase+f);
}
} catch (Exception e) {
return Result.error("system.err");
} catch (Throwable e) {
return Result.error("upload.formaterror");
}
}
$('#file_upload').uploadifive({
'auto': true,
'multi': false,
'width': '100%',
'height': '35',
'buttonText': '请选择图片',
'fileType': 'image/*',
'fileSizeLimit': 1024,
'queueSizeLimit': 1,
'formData': {},
'queueID': 'queue',
'uploadScript': '${base}/upload/image',
'onUploadComplete': function (file, data) {
data = JSON.parse(data);
if (data.code == 0) {
toastr.success(data.msg);
$("#img").html("<img src='" + data.data + "' style='width:150px;height:95px;'>");
$("#picurl").val(data.data);
} else {
clearFile();
toastr.error(data.msg);
}
},
'onDrop': function (file, fileDropCount) {
clearFile();
},
'onClearQueue': function (queue) {
clearFile();
},
'onCancel': function () {
clearFile();
}
});