SWFUpload Usage Summary

Source: Internet
Author: User

<script src= "${base}/thirdparty/swfupload/swfupload.js" type= "Text/javascript" ></script><script Src= "${base}/thirdparty/swfupload/swfupload.queue.js" type= "Text/javascript" ></script><script src= "$ {base}/thirdparty/swfupload/fileprogress.js "type=" Text/javascript "></script><script src=" ${base}/ Thirdparty/swfupload/handlers.js "type=" Text/javascript "></script><link href=" ${base}/thirdparty/ Swfupload/process.css "rel=" stylesheet "type=" Text/css "/>
<"/common/image_upload.html"/>
<@e. Text Label= "Authentication via icon"ID= "UploadImgPath1"class= "Dfinput"name= "icon"ReadOnly= "ReadOnly"/>                <@e. Text Label= "Picture path"ID= "UploadFileText1"size= "+"class= "Dfinput" />            <inputtype= "File"ID= "UploadFile1"size= "+"onchange= "$ (' #uploadFileText1 '). Val (this.value)"/>            <BR/>            <@e. Hidden ID= "Mark1"value= "false"/>            <@e. Button Class= "Upload-button"onclick= "Upload (1);"value= "Upload"/>            <BR/>            <atitle= "Title Figure 1"ID= "PREBIGIMG1"class= "Cmcss"href= "${base}/${(mmiGroupBanner1)!}"style= "margin-left:87px;margin-top:10px;" >                <imgID= "PREIMG1"style= "Width:100px;height:70px;background-color: #CCCCCC;"maxWidth2= "$" />            </a>             <@e. Text Label= "Authentication does not pass icon"ID= "UploadImgPath2"class= "Dfinput"name= "Xicon"ReadOnly= "ReadOnly"/>                <@e. Text Label= "Picture path"ID= "UploadFileText2"size= "+"class= "Dfinput" />            <inputtype= "File"ID= "UploadFile2"size= "+"onchange= "$ (' #uploadFileText2 '). Val (this.value)"/>            <BR/>            <@e. Hidden ID= "Mark1"value= "false"/>            <@e. Button Class= "Upload-button"onclick= "Upload (2);"value= "Upload"/>            <BR/>            <atitle= "Title Figure 2"ID= "PreBigImg2"class= "Cmcss"href= "${base}/${(mmiGroupBanner2)!}"style= "margin-left:87px;margin-top:10px;" >                <imgID= "PreImg2"style= "Width:100px;height:70px;background-color: #CCCCCC;"maxWidth2= "$" />            </a> 
 Packagecn.com.yhxl.jhahi.action.admin;ImportJava.util.Locale;Importjavax.servlet.http.HttpServletRequest;ImportJavax.servlet.http.HttpServletResponse;Importorg.apache.commons.io.FilenameUtils;Importorg.apache.shiro.authz.annotation.RequiresPermissions;ImportOrg.slf4j.Logger;Importorg.slf4j.LoggerFactory;Importorg.springframework.beans.factory.annotation.Autowired;ImportOrg.springframework.stereotype.Controller;ImportOrg.springframework.ui.ModelMap;Importorg.springframework.web.bind.annotation.RequestMapping;ImportOrg.springframework.web.bind.annotation.RequestMethod;ImportOrg.springframework.web.bind.annotation.RequestParam;ImportOrg.springframework.web.multipart.MultipartFile;ImportCn.com.yhxl.basic.entity.ms.MsSystemConfig;ImportCn.com.yhxl.basic.service.ms.IMsSystemConfigService;Importcn.com.yhxl.common.upload.FileRepository; @Controller Public classFileuploadact {Private Static FinalLogger log = Loggerfactory.getlogger (fileuploadact.class); Private Static FinalString result_page = "/common/iframe_upload"; @RequiresPermissions ("File:swfupload") @RequestMapping (value= "/file/o_swfupload.do", method =requestmethod.post) PublicString Swfattachsupload (String Root,integer uploadnum, @RequestParam (value = "UploadFile", required =false) Multipartfile file,httpservletrequest request, HttpServletResponse Response,modelmap model)throwsException {Mssystemconfig sc=Scservice.get (); String OrigName=File.getoriginalfilename (); String ext=filenameutils.getextension (OrigName). toLowerCase (Locale.english); String FILEURL= ""; Try {            if(Ext.equalsignorecase ("flv") | | | ext.equalsignorecase ("mp4") | | ext.equalsignorecase ("F4V") ) {FileUrl=Filerepository.storebyextvideo (Sc.getscvideouploadpath (), ext, file); FILEURL=Fileurl.replace (Sc.getscvideouploadpath (), Sc.getscvideoprefixurl ()); }Else if(Ext.equalsignorecase ("BMP") | | | ext.equalsignorecase ("PNG") | | ext.equalsignorecase ("jpg") | | ext.equalsignorecase (" Jpeg) ) {FileUrl=Filerepository.storebyext (Sc.getscphotouploadpath (), ext, file); }Else{FILEURL=Filerepository.storebyext (Sc.getscfileuploadpath (), ext, file); }            //Plus deployment Path//System.out.println ("fileurl=" +fileurl); //Filemng.savefilebypath (FileUrl, OrigName, false);Model.addattribute ("AttachmentPath", FILEURL); Model.addattribute ("Uploadpath", FILEURL); Model.addattribute ("Uploadnum", Uploadnum); returnResult_page; } Catch(Exception e) {log.error ("File Upload error occurred", E); Model.addattribute ("Error", E.getmessage ()); }        returnResult_page; } @Autowiredprotectedfilerepository filerepository; @AutowiredPrivateimssystemconfigservice Scservice;}

SWFUpload Usage Summary

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.