This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes File upload using html:file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File upload using html:file" Watch "File upload using html:file" New topic

File upload using html:file

Rafael Andrade

Joined: Aug 04, 2006
Posts: 15
I�m uploading a file to the database, and it works ok. I click on it, select the file, and the path is on the text area. But when I get the record, the text area is blank. How can I put the name of the file there?

in the jsp:
<html:file property="${}[${lineNumber-1}].formFile" styleClass="text" size="35"/>

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
While the HTML 4.0.1 specification says that a browser "may" display a default value in a file upload control, neither Internet Explorer nor Firefox will do so.

It's considered a security risk. Think about it: If a malevolent website wanted to upload information from your computer, all they'd have to do is set a default for say, your outlook address file, and then use JavaScript to submit the form automatically. As far as I know, there's no way to set a default upload file.

Consultant, Sima Solutions
I agree. Here's the link:
subject: File upload using html:file
It's not a secret anymore!