image preview problem..

Posted by Gopal_nivas under ASP.NET on 1/7/2010 | Views : 2711 | Status : [Member] | Replies : 5
HI..

I WANT TO PREVIEW AN IMAGE DURING FILE UPLOAD..

THE IMAGE WAS DISPLAYED IF I USE INTERNET EXPLORER BROWSER..

BUT IF I RUN THE APPLICATION IN FIREFOX BROWSER THEN IT DOESNOT SHOW(PREVIEW) THE IMAGE..


I WANT TO DISPLAY THE IMAGE IN BOTH THE BROWSERS..

NEED UR SUGGESTIONS..

GIVE SOME EXAMPLES ..

REGARDS
GOPAL.S




Responses

Posted by: Nishithraj on: 1/7/2010 [Member] Bronze

Up
0
Down
Would you mind copying your code here?

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopal_nivas on: 1/7/2010 [Member] Starter

Up
0
Down
its a javascript..

using that script the image is displayed onle in IE.

i want to display image in both IE and Firefox..

give some suggestions and examples to rectify this..

regards
gopal.s

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mehulthakkar1 on: 1/7/2010 [Member] Starter

Up
0
Down

IE 6 only support view from javascript

For IE 7, after applying some configuration changes it will preview from javascript.

But why you want to preview of your file?

Have you seen some where such kind of example? if yes then try with IE 7 and above

Thanks
Mehul Thakkar

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopal_nivas on: 1/7/2010 [Member] Starter

Up
0
Down
hi..

IMAGE WAS DISPLAYING IN IE BUT NOT IN FIREFOX..

MY NEED IS IF I USE EITHER IE OR FIREFOX IMAGE SHOULD BE DISPLAYED..

HOW TO DO THIS..

REGARDS
GOPAL.S

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 1/8/2010 [Member] Bronze

Up
0
Down
Gopal,

Can you test with the following code & let me know if it works or not.

<script language="javascript">

var imgRe = /^.+\.(jpg|jpeg|gif|png)$/i;
function previewImage(pathField, previewName)
{
var path = pathField.value;
if (path.search(imgRe) != -1)
{
document[previewName].src = 'file://'+path;
}
else
{
alert("JPG, PNG, and GIFs only!");
}
}
</script>

<div align="center">
<form name="form1">
<input type="file"
name="myImage"
size="30"/>
<input type="button"
value="Preview!"
onClick="previewImage(document.form1.myImage,
'replaceMe')"/><br>
<img src="images/clear.gif" name="replaceMe"/>
</form>
</div>


Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response