Custom HtmlInputFile

  • Thread starter Augusto Cesar via DotNetMonster.com
  • Start date
A

Augusto Cesar via DotNetMonster.com

Hi, I want to customize the HtmlInputFile. I wanna something like an image
button to play the "browse" button hole and hide the textbox. Is that
possible?

I also have tried to hide an HtmlInputFile in my page and added some
javascript code to a button to fire the click() event of the HtmlInputFile.
It worked for a moment, but when the submit button is clicked the
HtmlInputFile looses its value. This solution was described in the
following link: http://p2p.wrox.com/topic.asp?TOPIC_ID=4772

Thanks
 
K

Kevin Spencer

Hi, I want to customize the HtmlInputFile. I wanna something like an image
button to play the "browse" button hole and hide the textbox. Is that
possible?
Nope.

I also have tried to hide an HtmlInputFile in my page and added some
javascript code to a button to fire the click() event of the
HtmlInputFile.
It worked for a moment, but when the submit button is clicked the
HtmlInputFile looses its value. This solution was described in the
following link: http://p2p.wrox.com/topic.asp?TOPIC_ID=4772

I copied the exact code that was on that page, and added another button
called "Display" that calls a function that puts up an alert box with the
value of the hidden file upload element. When I clicked the "Upload File"
button, I got the dialog box, selected a file, and saw the value in the text
box. I then clicked the "Display" button, and saw the same value from the
hidden file upload element.

Conclusion: You did something wrong. What, I don't know.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
A

Augusto Cesar via DotNetMonster.com

Thanks for your reply.

The problem with that code is when you have to do something in the server
side. Try to put a button that submits to the server, like an asp:button,
to make the upload of the selected file. After you select the file, the
button doen't submit to the server and clear the value of the HtmlInputFile
when clicked.
In the client side it is all OK with that code, but I can't get the
selected file in the server side.

I will apreciate if somebody suggest another way to do that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top