yohuy
asked on
How do I put an image instead of the Browse button when using <INPUT type=file ?
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 ?
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 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
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>
<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">
<input type=text name=filetext2><a onclick="browse();">This could be an image</a>
</form>
</body>
</html>
bah, sorry...didn't read your question through :/ i guess you already tried that..
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&
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&
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&
in about a week. I would appreciate any comments from the
participants on how it should be disposed of.
Cd&
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&
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&
Comment from DreamMaster accepted as answer.
Thank you
Computer101
Community Support Moderator
Thank you
Computer101
Community Support Moderator
Thanks Computer101 :)
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&