|
||||
it is open source browser. The best browser for OpenSource OS like Linux.
![]() Official website: http://www.mozilla.org |
|
|||
I dont think it will work for mozilla. I have the same thing on the website I am working on and it only work for IE. I have not tested whether it is regarding onchange but I do know type="file" have some security restriction and things like set the type="file" with initial value can not be done either IE or Mozilla/Netscape.
__________________
Venzon Solution Services |
|
||||
I know the code does not work on Mozilla, just wonder is there any alternative way to do the same thing in Mozilla or not... :/
Btw, according to W3.org: Quote:
|
|
||||
Addition info about type=file
- security risk for initial value on type=file: http://www.insecure.org/sploits/nets...type.file.html Mozilla ignore the value: http://www.geocrawler.com/archives/3...2/4/0/8331991/ Guess IE also ignore the value as well. |
|
|||
You need to stripslashes for it to work in mozilla
For example (hardcoded): The following won't work: Code:
<script>
function changePhoto() {
document['tempPic'].src = "file:///C:\dir1\dir2\somepic.jpg";
}
</script>
However, the following will work in Mozilla: Code:
<script>
function changePhoto() {
document['tempPic'].src = "file:///C:\\dir1\\dir2\\somepic.jpg";
}
</script>
Quote:
Basically, in my opinion, if something works in Mozilla, it will work in IE. The Mozilla browser follows the recommendation of the W3C very tightly. IE is very loose on standards. |
|
||||
Thank you sufyan. I will try it now.
Quote:
|
|
||||
Code:
<script>
function changePhoto() {
document['tempPic'].src = "file:///C:\\dir1\\dir2\\somepic.jpg";
}
</script>
|
|
|||
Interesting... how about try throwing in a preview button?
Code:
<html>
<head>
<title>Upload Photo</title>
<script>
function changePhoto() {
document['tempPic'].src = "file:///C:\\Documents and Settings\\Sufyan\\My Documents\\My Received Files\\gfhfgh.JPG";
}
</script>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<img name="tempPic">
<input type="file" name="picPath">
<input type="button" name="preview" value="Preview Image" onClick="changePhoto();">
<input type="submit" name="upload" value="Upload">
</form>
</body>
</html>
|
|
||||
no problem with preview button.
![]() So, shall we conclude that Mozilla does not fire onChange event on "Browse..." button? ![]() And here is the workaround code for both IE and Mozilla: Code:
<html>
<head>
<title>Upload Photo</title>
<script>
function changePhoto() {
document['tempPic'].src = "file:///" + document.form1.picPath.value;
}
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<img name="tempPic">
<input type="file" name="picPath" onChange="changePhoto();">
<input type="button" name="preview" value="Preview Image" onClick="changePhoto();">
<input type="submit" name="upload" value="Upload">
</form>
</body>
</html>
![]() |













