Jump to content

$_FILES brower problem


believeinsharing

Recommended Posts

Hi,

I have simple php code with HTML.. but its not working with all browser, some time its works in Chrome sometimes its not working in IE

I have saved this filr as index.php

 

its code is:

 

<html>

<head> <title>

Upload

</title> </head>

<body>

<form action="index2.php" method="POST" enctype="multipart/form-data">

Image:

<input type="file" name="myImage" />

<input type="submit" value="Upload" />

</form>

<?php

 

echo $_FILES["myImage"]["tmp_name"];

 

?>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/249940-_files-brower-problem/
Share on other sites

Try this?

 

<html>
<head> <title>
Upload
</title> </head>
<body>
<form action="index.php" method="POST" enctype="multipart/form-data">
Image:
<input type="file" name="myImage" />
<input type="submit" value="Upload" />
</form>
<?PHP

  if($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo $_FILES["myImage"]["tmp_name"];
  } else {
    echo 'No form has been submitted.';
  }

?>
</body>
</html>

@ PaulRyan:

 

Hi thanks for ur reply..

 

I copied ur code, its working in chrome, but in IE its showing default echo statement for a first time ie "No form has been submitted. " but once u select an image in click on upload from get clear.. no data in "file type" and nothing in echo...

 

does it prob with brower or code?

 

Thanks again

See if there is an error in the $_FILES array.

 

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo "Errors: {$_FILES['myImage']['error']}<br>"; // <--- ADD THIS LINE
    echo $_FILES["myImage"]["tmp_name"];
  } else {
    echo 'No form has been submitted.';
  }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.