believeinsharing Posted October 27, 2011 Share Posted October 27, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/ Share on other sites More sharing options...
PaulRyan Posted October 27, 2011 Share Posted October 27, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1282831 Share on other sites More sharing options...
believeinsharing Posted October 28, 2011 Author Share Posted October 28, 2011 @ 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 Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1282903 Share on other sites More sharing options...
Pikachu2000 Posted October 28, 2011 Share Posted October 28, 2011 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.'; } Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1282904 Share on other sites More sharing options...
believeinsharing Posted October 28, 2011 Author Share Posted October 28, 2011 @ Pikachu2000: Thanks alot ur code is working in both chrome and IE.. I am new to PHP that why not sure what ws the prob.. if u tell me more abt the code this will help me in future.. thanks again Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1282984 Share on other sites More sharing options...
Pikachu2000 Posted October 28, 2011 Share Posted October 28, 2011 There is no reason for the line I added to make it all of a sudden start working. Something else must have changed. Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1283020 Share on other sites More sharing options...
believeinsharing Posted October 28, 2011 Author Share Posted October 28, 2011 @Pikachu2000: Thanks alot.. Quote Link to comment https://forums.phpfreaks.com/topic/249940-_files-brower-problem/#findComment-1283051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.