commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bodin, Derek Allen" <bodi...@uwec.edu>
Subject RE: URGENT PROBLEM
Date Thu, 20 Feb 2003 22:52:05 GMT
If I remeber correctly there is no method getFileName(), it is just getName().  I belive I
ran into the same problem.
 
-Derek

	-----Original Message----- 
	From: Gaston Escobar [mailto:gescobar@451.com] 
	Sent: Thu 2/20/2003 2:26 PM 
	To: commons-user@jakarta.apache.org 
	Cc: 
	Subject: URGENT PROBLEM
	
	


	I don't really know where to post this e-mail. I'm sorry in case I've made a
	mistake.
	I've tried to use the FileUpload package I downloaded. But in the example
	code, it throws an error when I try to compile it.
	This is the example code that comes with the package:
	
	    public void doPost(HttpServletRequest req, HttpServletResponse res)
	    {
	        FileUpload fu = new FileUpload();
	        // maximum size before a FileUploadException will be thrown
	        fu.setSizeMax(1000000);
	        // maximum size that will be stored in memory
	        fu.setSizeThreshold(4096);
	        // the location for saving data that is larger than
	getSizeThreshold()
	        fu.setRepositoryPath("/tmp");
	
	        List fileItems = fu.parseRequest(req);
	        // assume we know there are two files. The first file is a small
	        // text file, the second is unknown and is written to a file on
	        // the server
	        Iterator i = fileItems.iterator();
	        String comment = ((FileItem)i.next()).getString();
	        FileItem fi = (FileItem)i.next();
	        // filename on the client
	        String fileName = fi.getFileName();
	        // save comment and filename to database
	        ...
	        // write the file
	        fi.write("/www/uploads/" + fileName);
	    }
	
	
	And this is the error my compiler throws:
	
	UploadServlet.java:34: cannot resolve symbol
	symbol  : method getFileName  ()
	location: interface org.apache.commons.fileupload.FileItem
	        String fileName = fi.getFileName();
	                            ^
	1 error
	
	-----------------------
	
	Please, help me. And in case this e-mail was not correctly posted here, tell
	me where I could do that
	Thank you very much
	
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
	For additional commands, e-mail: commons-user-help@jakarta.apache.org
	
	


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message