How do i get the name of the file from a file upload form?

sachin thukral

Using Jason Hunter's O'reilly Servlet package, if you pass some parameter as query String or hidden variable,then only by using Vectors I was getting parameters which was passed from the previous page. Since in multipart forms Request.getPararmeter does not work.

But it is possible to get filename of the file which is uploded (I suppose this is your requirement).

Using iws.getWorkingDirectory will give you the current working directory. Now using the following you can get the filename,just try the last one as well to get the requested parameter(I'm not sure for the last line)

	MultipartRequest multi = new MultipartRequest(request, basedir, iSize);
	Enumeration files = multi.getFileNames();
	String strText = multi.getParameter("txtLink");
Now easily you can enumerate through the file names.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.