Link to home
Start Free TrialLog in
Avatar of ayen
ayen

asked on

reg the input tag of type file

Hi,

we are using a file upload utility in our web application. We wanted to upload the document and save it in our db2 database.

we want to know about two things

1. when we are using the html tag <input type='file' value =''> we are getting the standard java browse button. we wanted to replace this with our button image. how we can over ride this.

2. when we click the upload button the selected file should be carried to the server how we can process this. i have some basic idea of implementing this with the multipart form. can anyone highlight on this.


Thanks & Rgds,
Murali
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ovi
Ovi

1. You can try via CSS to setup your browse button look.
2. As above by TimYates.

Cheers.
>  1. You can try via CSS to setup your browse button look.

Doesn't work :-(

At least I couldn't get it to work...  Because the FILE input thing is hardwired to the browser and OS, and isn't affected by CSS...  Apparently, you "could" change the "Browse" text by using a signed bit of javasript in one version of Mozilla...  But in real life it really isn't worth the effort trying...  You have to make do with the boring, boring style that's given to you :-(
OOOOOOOOOOOOH!

Just did some searching around again, and it looks like Ovi was right:

http://www.quirksmode.org/dom/inputfile.html

However it has to be sait that you should be careful with soing this, as it doesn't really look like it's going to select a file from your hard drive (as I am used to FILE tags unstyled), so you could have problems with usability...
And, if you look at that page....it's a complete pain in the arse...  And each browser you are writing for will look slightly different (unless you jump through css/javascript hoops)

So;  if it's for an intranet site, where you know what browser is going to be used...it could be cool.... otherwise, it's probably not worth the effort :-)

Lazy Tim

;-)
Yeah, Tim, you're right.

I have not done this for the bowse button, but I did once for a submit button with pure CSS. I guess should work in this case too.
It's weird, because the "Browse" button is tied into the browser (for th file select dialog), it tends to ignore all CSS and attempts at restyling it :-(

As you say, sumbit buttons and normal text fields are easy with CSS :-)