Php & Internet Explorer 2, Part Two |
||
Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.
In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.
Zymic Webmaster Forums Web Design & Development Server Side Scripting PHP |
||
![]() |
Php & Internet Explorer 2, Part Two |
||
Nov 22 2010, 06:07 PM
Post
#1
|
|
![]() PHP Programmer ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 895 Joined: 9-March 08 From: Naples, FL Member No.: 13,296 |
Like I said in my other one.. This code works great on Firefox and Chrome but not IE. Can't figure out why. It's supposed to verify the file is a gif,jpg or png and then upload it if it IS and give an error if it's not. If you'll notice, there are two ways it can fail and the error the user gets (only in IE) is "Avatars must be .jpg, .gif or .png formats!" even if it IS. It won't let you upload anything. I tried JPG, PNG, GIF, etc.
CODE <?php
session_start(); include 'g_includes.php'; if (($_FILES["avatarfile"]["type"] == "image/gif") || ($_FILES["avatarfile"]["type"] == "image/jpeg") || ($_FILES["avatarfile"]["type"] == "image/png" )) { $targetpath = "useravatars/"; $targetpath = $targetpath . $g_userid . ".jpg"; //Yes, I know I am adding a .jpg to the end of it no matter what but this wouldn't be the problem. if(move_uploaded_file($_FILES['avatarfile']['tmp_name'], $targetpath)) { $sql = "UPDATE users SET avatar='$targetpath' WHERE id='$g_userid'"; mysql_query($sql) or die("Couldn't upload!"); $message = "Your new avatar has been uploaded! You might have to refresh the page to see it."; $sql = "INSERT INTO news(userid,message) VALUES('$g_userid','$message')"; mysql_query($sql) or die("Couldn't insert message!"); } else{ $message = "Unable to upload the file. "; $sql = "INSERT INTO news(priority,userid,message) VALUES(2,'$g_userid','$message')"; mysql_query($sql) or die("Couldn't insert message!"); } } else{ $message = "Avatars must be .jpg, .gif or .png formats!"; $sql = "INSERT INTO news(priority,userid,message) VALUES(2,'$g_userid','$message')"; mysql_query($sql) or die("Couldn't insert message!"); } ?> <script type="text/javascript"> // <!-- window.location = "g_account.php" //--> </script> |
|
|
Nov 22 2010, 11:18 PM
Post
#2
|
|
|
Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Moderators Posts: 1,805 Joined: 10-July 08 From: UK Member No.: 44,994 |
Try dumping out the contents of $_FILES - you'll find IE isn't setting the mime type correctly. My guess would be it's missing out the image/ part.
Swordz |
|
|
May 16 2012, 07:10 AM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 20 Joined: 14-October 11 Member No.: 213,597 |
Hello friends,
i am trying to remove extension from my inner pages ie. abc.com/books.php ---> to ----> abc.com/books. how can i convert this in php ? |
|
|
![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 19th June 2013 - 06:16 PM |