java - Uploadify doesn't send filename -
I'm trying to use Uploadify for uploading multiple files, And there is a spring controller with comons-fileupload 1.2.1 on server side. I need to get the original name of the uploaded file, and when using the standard input tag it is fine - name where it should be and Item.getName () returns it back as expected only, however, when Uploadify returns item.getName (), it returns zero. Is there a way to get the name?
$ ('# Fileuploadinput'.) Uploadify ({uploader: '/js/uploadify/uploadify.swf', script: '/ uploadpath', cancelImg: '/js/uploadify/cancel.png', multi: true , FileDataName: 'uploadFile'});
for
(org.apache.commons.fileupload.FileItem item: items) {string name = item.getName (); // some other stuff}
I am using spring MVC, they provide, org.springframework. Web.multipart.multipartfile
You can use the method, getOriginalFilename () to get the file name.
More information can be found from
@RequestMapping (value = "upload", method = RequestMethod.POST) public string processUpload (@RequestParam MultipartFile file, model map model map, HttpServletRequest request) Exceptions thrown {
log.debug ("= ======= Upload file:" + file.getOriginalFilename ()); }
Comments
Post a Comment