Adobe Flex FileReference upload file. Struts 2 on server sid

Commonly used J2EE server side frameworks.

Adobe Flex FileReference upload file. Struts 2 on server sid

Postby haretu » Wed May 11, 2011 3:56 pm

Adobe Flex FileReference upload file. Struts 2 on server side.

Adobe Flex code
Code: Select all
      var req:URLRequest = new URLRequest(FILE_UPLOAD_URL);
  var    ref:FileReference = FileReference(files[i]);
                    //add parameters
                       var newfile:URLVariables = new URLVariables();
        newfile.para1= somedata;
                               newfile.para2= somedata;

                req.data = newfile;
                ref.upload(req,"sampleFile",false);


The above "sampleFile" is about the same as in struts 2 <s:file name="sampleFile" label="File"/>

As normal struts 2 uploading file action
Code: Select all
   private File sampleFile;
   private String sampleFileContentType;
   private String sampleFileFileName;
                 private String para1;
                 private String para2;

                setters and getters for above parameters.

                 .............
                public String uploadfile()
                {
             ..........
                  return SUCCESS;
               }


in struts.xml specify like:(Using JSON)
Code: Select all
      <action name="uploadfile" method="uploadfile" class="SaveUpdate">
           <result type="json"/>
        </action>
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to struts,spring,hibernate

Who is online

Users browsing this forum: No registered users and 0 guests

cron