Solved

How do I put an image instead of the Browse button when using <INPUT type=file ?

Posted on 2001-07-25
10
185 Views
Last Modified: 2008-02-20
How do I put an image instead of the "Browse" button when using <INPUT type=file ... ?

or

 I tried to use the click method in order to open the "Browse" button on the <INPUT type=file ...> control. Well, it did open but when I tried to submit the form using either the submit() method or using <INPUT type=submit  ...> control I got a javascript error "Access denied".
How can I put a value in the <INPUT type=file ...> without having to manualy type in the path or manualy clicking on the "Browse" button ?
0
Comment
Question by:yohuy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 19

Accepted Solution

by:
DreamMaster earned 75 total points
ID: 6321004
You can't...the problem with this <input type=file is that it is a control that allready has the browse button along with it...You cannot change it unless you customize all of it and that would be way too much work for what it actually does..

Cheers,
Max.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6321560
Any attempt to customize that I have seen actually change the browse button ends up with a non-functional browse button and in most cases the form is broken any way.

The browse button cannot be modified for security reason.  if it could be disquised, it would be a way for thieves to fool users into uploading files.

Cd&
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6321581
Exactly Cd&,

Security with these kinds of things is very strict, for the same reason it is not possible to select a file for it using scripting....as it would allow someone to auto send a file from your harddisk to their own...

Max.
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 2

Expert Comment

by:psogaa
ID: 6321726
You can hide the original input form with style...then the rest is up to javascript...something like this:

<html>
<head>
<title></title>
<script language="JavaScript">
function browse(){
  testForm.filetext.click();
  testForm.filetext2.value = testForm.filetext.value;
}
</script>
</head>
<body>
<form name=testForm>
  <input type=file name=filetext style="visibility:hidden"><br>
  <input type=text name=filetext2><a onclick="browse();">This could be an image</a>
</form>
</body>
</html>
0
 
LVL 2

Expert Comment

by:psogaa
ID: 6321734
bah, sorry...didn't read your question through :/ i guess you already tried that..
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6351887
yohuy,

The name of this site is experts-EXCHANGE because we exchange information.  You are serious about solving your problem, you need to participate by responing to the comments.  If you treat this like a new group, or the amateur forums, you will probably not get very good results.  We solve problems with dialog no one has posted in over a week because you have not responded, and it is not going to be taken seriously.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6537532
To close this out, I will be making a recommendation to CS
in about a week.  I would appreciate any comments from the
participants on how it should be disposed of.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6616352
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>

Points to DreamMaster
</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6616697
Comment from DreamMaster accepted as answer.

Thank you
Computer101
Community Support Moderator
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6618449
Thanks Computer101 :)
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question