Waldo Mendoza <wmendoza <at> umsa.bo> writes: > I was playing with the Upload component, and i saw that IUploadFile has this > method: > > public void write(File file); > > and the process to upload a file with this method is really short than the > method explained in the Upload component reference documentation. My listener > method is just: > > public abstract IUploadFile getFile(); > > public void uploadFile(IRequestCycle cycle) { > String path = getRequestCycle().getRequestContext() > .getServlet().getServletContext().getRealPath(""); > > File destFile = new File(path + "/" + file.getFileName()); > file.write(destFile); > } > > Is there any difference of those aproaches?, maybe some performance issue?
The main difference is that the sample code in the reference is just sample code. It shows you how to read the uploaded file through a stream. This is more flexible than writing it to a file. Of course it's simpler to just call write() if you really want to write it to a file. In fact, the write() method is more efficient as it will try to use a file rename as long as possible. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]