Problem with image in Mozilla ?? please help

This is a discussion on "Problem with image in Mozilla ?? please help" within the JavaScript Forum section. This forum, and the thread "Problem with image in Mozilla ?? please help are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 20th, 2006, 11:04
Junior Member
Join Date: Jul 2004
Location: Bulgaria
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with image in Mozilla ?? please help

Hi -

i have written a little script that displays the image that is about to be uploaded.
it works great in IE but not in Mozilla Firefox.

in fact BOTH the control image and the upload image are shown as broken links in Mozilla.

Does anyone know how to fix this ??

Here is the code

Code: Select all
<?php 
/* upload.php
*
*/

if (!isset($_POST[upload])) {
$message1 = "Enter File Path";
$message2 = " Now "; 
include ("upload_form.php");
} // endif
else {
if($_FILES['pix']['tmp_name'] == "none") {
$message1 = "File did not successfully upload.";
$message2 = "Check the file size. Must be less than 250K";
include ("upload_form.php");
exit();
} // endif

if(!ereg("image",$_FILES['pix']['type'])) {
$message1 = "File is not a picture file.";
$message2 = "Please try a different file.";
include ("upload_form.php");
exit();
} // endif

else { 
$destination = 'd:\Web\images'."\\".$_FILES['pix']['name'];
$temp_file = $_FILES['pix']['tmp_name'];
move_uploaded_file($temp_file,$destination);
$message1 = "File has been successfully uploaded.";
$message2 = "CONGRATULATIONS !"; 
include ("upload_form.php");
exit(); 
} // end else
} // end else

?>
----------------------------------------------------

and the form :



Code: Select all
<?php 
/* upload_form.php
*
*/

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Upload_form.inc
Description : displays the a form for uploading data
-->
<html>
<head>
<title>Untitled</title>

<script language="JavaScript" type="text/javascript">
<!--
function changeSrc1(who){
img=who.replace(who.substring(0,1),'file:///'+who.substring(0,1));//add 'file:///' before the drive letter
img=img.replace(/\\/g,'/');//replace all backslashes with forward slashes
document.getElementById('pre_veiw').src=img;
} // end of function
-->
</script>

</head>
<body>

<div style='position:absolute; left:20px; top:60px'>
<form name = 'main' enctype ="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name ="MAX FILE SIZE" value="500000">
<table width="400px" border="0" cellspacing="0" cellpadding="1">
<tr>
<td>Picture file path: </td> 
<td>
<input type="file" id="x_pix1" size="50" onchange="changeSrc1(this.value)" 
name="pix" value = "<?php echo $x_pix1 ?>">
</td></tr>

<tr><td>
<input type="submit" name="upload" value="Upload Picture">
</td></tr>
</table>
</form>
</div>

<div id='Previewer' style='position:absolute; left:30px; top:200px' >
<img src="file:///D:/Web/images/control.jpg" border="0">
<img id="pre_veiw" width="120" height="120" />
<br>
- - - Picture 1 - - -
</div>

<div style='position:absolute; left:200px; top:300px'>
<?php echo $message1 ?><br>
<?php echo $message2 ?><br>
</div>

</body>
</html>

Last edited by herkalees; May 20th, 2006 at 16:03.
Reply With Quote

  #2 (permalink)  
Old May 20th, 2006, 16:03
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to herkalees Send a message via MSN to herkalees Send a message via Yahoo to herkalees
Re: Problem with image in Mozilla ?? please help

Please wrap long bits of code inside [ CODE ] xxx [ /CODE ] tags.

Best of luck with your question.
Reply With Quote
Reply

Tags
problem, image, mozilla, help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Seeing Image In Mozilla Geeky Girl Graphics and 3D 10 Mar 23rd, 2008 01:21
[SOLVED] Another problem with mozilla thewebkid Web Page Design 12 Nov 29th, 2007 14:39
[SOLVED] Problem with float - In mozilla jram Web Page Design 4 Oct 20th, 2007 06:11
odd slideshow problem (fine in IE, not in Mozilla) jono JavaScript Forum 7 Mar 17th, 2005 08:42
IE/Mozilla problem crip Web Page Design 1 Feb 12th, 2004 18:33


All times are GMT. The time now is 10:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43