/**
* Video Upload
* DDL
* @param request
* @param response
* @param files
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping (value = "/multiupladvideo")
Public Object Multiupladvideo (httpservletrequest request, httpservletresponse response, @RequestParam ("Files") Commonsmultipartfile[] files) throws exception{
try {
List<object> filepathlistvideo=new arraylist<> ();
if (null!=files) {
for (int i = 0;i<files.length;i++) {
if (!files[i].isempty ()) {
Object filepath= Imageuploadwangeditor (Request,response,files[i]);
Jsonobject jsonobject = Json.parseobject (filepath.tostring ());
if (jsonobject.getstring ("Success"). Equals ("true")) {
Filepathlistvideo.add (jsonobject.getstring ("Data"));
}
}
}
}
Return Jsonutil.successmessage ("Video upload Successful", filepathlistvideo);
} catch (Exception e) {
E.printstacktrace ();
Return Jsonutil.failmessage ("video upload Failed");
}
}
/**
* File Upload (image)
* @param request
* @param response
* @param file
* @return
* @throws Exception
*/
@RequestMapping (value = "/imageupload")
@ResponseBody
Public Object Imageuploadwangeditor (httpservletrequest request, httpservletresponse response, Multipartfile file) Throws Exception {
Get file name
String fileName = uuid.randomuuid () + file.getoriginalfilename ();
Dump files
String type = File.getcontenttype ();
if (Type.equals ("Video/mp4")) {
Return UploadFile (fileName, file, "Journal_video");
}else{
Return UploadFile (fileName, file, "Journal_images");
}
}
Java multiple uploads commonsmultipartfile[] files