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
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>

Link to comment
Share on other sites

@ 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

Link to comment
Share on other sites

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.';
  }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.