Io stream Save upload picture

Source: Internet
Author: User

@RequestMapping (value = "Filesupload")     Public voidfilesupload (@RequestParam multipartfile[] file, httpservletrequest request, @RequestParam Strin            G name, @RequestParam Integer size, @RequestParam string type, @RequestParam string Flagcode, String skuId ) throwsIOException {/*if (Common.notempty (skuId)) {Getimginfo (Flagcode, SkuId, "Mall_" +flagcode+ "" +skuid); }*/List<String> list =NewArraylist<string>(); if(File! =NULL&& file.length > 0) {             for(inti = 0; i < file.length; i++) {multipartfile files=File[i]; //Save FileList =saveFile (Request, files, list,name, size, type,flagcode,skuid); }        }    }        PrivateList<string>SaveFile (httpservletrequest request, Multipartfile file, List<String> list,string filename,integer filesize,string filetype,string flagcode,string skuId)throwsIOException {//determine if the file is empty        if(!File.isempty ()) {            Try {                //saved file path (if using a TOMCAT server, the file is uploaded to the \\%tomcat_home%\\webapps\\yourwebproject\\upload\\ folderString uuid =Common.get32uuid (); String Uploadpath=propertiesutil.get ("/module.properties", "Mall.uploadpath"); String Filenmae=File.getoriginalfilename (); String NameType= Filenmae.substring (Filename.lastindexof (".") +1); String Attpath=uuid+ "." +NameType; //savemallattachment (Uuid,filename, FileSize, FileType, attpath,flagcode,skuid);String FilePath = Uploadpath.replaceall ("/", "\\\\") +Attpath;                List.add (File.getoriginalfilename ()); File Savedir=NewFile (FilePath); if(!Savedir.getparentfile (). exists ()) Savedir.getparentfile (). Mkdirs (); //Dump Files//File.transferto (savedir);Filecopyutils.copy (File.getinputstream (),NewFileOutputStream (Savedir)); returnlist; } Catch(Exception e) {e.printstacktrace (); }        }        returnlist; }

Io stream Save upload picture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.