472,143 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Replacing the normal browse button (fileupload asp.net) with an image

304 100+
Hi,
I would like to know as to how one could replace the normal browse button (file upload control) with an image.
Thanks,
Gomzi.
Jun 6 '07 #1
8 10964
kenobewan
4,871 Expert 4TB
Have you tried placing the image on the page and giving it an onclick event? Or do you mean something else?
Jun 6 '07 #2
gomzi
304 100+
Have you tried placing the image on the page and giving it an onclick event? Or do you mean something else?
Sorry mate . Didn't get you.
What I wanna achieve is this -> There is an fileupload control in .NET which provides the users to upload files. That control displays a default browse button which I would like to customize. i.e. replace it with an image.

Thanks,
Gomzi.
Jun 6 '07 #3
Plater
7,872 Expert 4TB
You could probably control it with CSS.
Set the text(the word "browse") to a blank string " " or something, then change the css background-image properies and such to what you want?
Jun 6 '07 #4
gomzi
304 100+
You could probably control it with CSS.
Set the text(the word "browse") to a blank string " " or something, then change the css background-image properies and such to what you want?
Had a look at the properties. None of them will help me in achieving that.
Jun 6 '07 #5
Plater
7,872 Expert 4TB
Don't think you looked to hard.

In CSS for that that object put
Expand|Select|Wrap|Line Numbers
  1. background-image: url(mypicture.jpg);
  2.  
Jun 6 '07 #6
gomzi
304 100+
Don't think you looked to hard.

In CSS for that that object put
Expand|Select|Wrap|Line Numbers
  1. background-image: url(mypicture.jpg);
  2.  

Hmm........

That doesn't replace the default button with the image. It sets the background of the textbox (where the file to be uploaded will be displayed).
Jun 6 '07 #7
Plater
7,872 Expert 4TB
hmmm indeed
perhaps you could make it invisible and then add a custom button and textbox that proxy through it?

Like clicking your custom picturebutton caused javascript to "click" the hidden file upload button ?
Jun 6 '07 #8
gomzi
304 100+
hmmm indeed
perhaps you could make it invisible and then add a custom button and textbox that proxy through it?

Like clicking your custom picturebutton caused javascript to "click" the hidden file upload button ?
This is the only thing present for the fileupload (on view source)
<input type="file" name="FileUpload1" id="FileUpload1" class="upload" />
Nothing specifically for the button.
Jun 6 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by UJ | last post: by
1 post views Thread by akshakeel | last post: by
2 posts views Thread by =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post: by
9 posts views Thread by shapper | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.