Issue Details (XML | Word | Printable)

Key: FILEUPLOAD-72
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Pablo
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons FileUpload

Java docs bug

Created: 22/Aug/03 04:12 AM   Updated: 09/Mar/07 08:32 PM
Return to search
Component/s: None
Affects Version/s: 1.0 Alpha
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Operating System: All
Platform: PC

Bugzilla Id: 22643


 Description  « Hide
You have published this code in the javadocs main page of the FileUpload and
the last line of the code isn't right "fi.write("/www/uploads/" + fileName);"
because the method write() doesn't accept Strings as parameters. Bye and thanks
for the excelent library that you are sharing.

public void doPost(HttpServletRequest req, HttpServletResponse res)

{ DiskFileUpload fu = new DiskFileUpload(); // 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.getName(); // save comment and filename to database ... // write the file fi.write("/www/uploads/" + fileName); }

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
John McNally added a comment - 13/Jan/04 02:43 PM
Modified to use File object