Solved

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

Posted on 2001-07-25
10
178 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
  • 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now