correction try { upFile.upload(request,"upFile");// upFile.upload(request,"logoFile"); upFile is the name use in the jsp page
} catch (error:Error) { //trace("Unable to upload file."); } azurs a écrit : > hello > to implement java upload you need a jsp page in your application directory > view this exemple > ---------------------------------------------------------- > Upload.jsp > <%@ page language="java" > import="javazoom.upload.*,java.util.*,java.lang.*" %> > <%@ page errorPage="ExceptionHandler.jsp" %> > <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" > > <jsp:setProperty name="upBean" property="folderstore" > value="C:/fds2/jrun4/servers/default/samples/your_application/upload_directory" > > > /> > </jsp:useBean> > </jsp:useBean> > <% > > if (MultipartFormDataRequest.isMultipartFormData(request)) > { > > MultipartFormDataRequest mrequest = new > MultipartFormDataRequest(request); > > Hashtable files = mrequest.getFiles(); > if ( (files != null) && (!files.isEmpty()) ) > { > upBean.store(mrequest, "upFile"); > > } > > } > %> > > you need also the bean include in the zip file, put it in > C:\fds2\jrun4\servers\default\samples\WEB-INF\lib\ > > http://www.taguemount.fr/flex/WEB-INF.zip > <http://www.taguemount.fr/flex/WEB-INF.zip> > > in your flex application use this code MXML > > private var upFile:FileReference = new FileReference(); > > private function fileBrowse():void{ > var imageFilter:FileFilter = new FileFilter("Image Files > (*.jpg, *.jpeg, *.gif, *.png, *.pdf)", "*.jpg; *.jpeg; *.gif; *.png; > *.pdf"); > > > upFile.browse(new Array(imageFilter)); > > } > private function selectHandler(event:Event):void { > var request:URLRequest = new > URLRequest("http://localhost:8700/samples/your_application/Upload.jsp > <http://localhost:8700/samples/your_application/Upload.jsp>") > request.method=URLRequestMethod.POST; > > try { > upFile.upload(request,"logoFile"); > } catch (error:Error) { > > //trace("Unable to upload file."); > } > } > private function completeHandler(event:Event):void { > > //trace("uploaded"); > } > > taguemount nacer > http://www.taguemount.fr/ <http://www.taguemount.fr/> > [EMAIL PROTECTED] <mailto:taguemount.nacer%40free.fr> > > [EMAIL PROTECTED] <mailto:grant%40bluetube.com> a écrit : > > >I'm trying to implement the file upload using the FileReference class > and can't find an example of the JAVA code that would be required, > I've found .net and php but no java, does anyone have an example ? > > > >Cheers > >Grant > > > > > > > >