Jump to content

[SOLVED] Yet another script that works in Firefox and not IE


bluedaniel

Recommended Posts

This is an picture upload script that works in Firefox but not IE.

 

Im only uploading a part of the script that I think is the culprit, if you need to see more I will oblige

 

The error in IE is "Im sorry you can only upload a JPG which is under 1MB in size" which is outputted at the end of the script.

 

<?php
  if (isset($_POST['upload'])) {
      if (isset($_FILES['uploaded_pic'])) {
          $id = $_POST['recipeID'];
          $filename = basename($_FILES['uploaded_pic']['tmp_name']);
          $ext = substr($filename, strrpos($filename, '.') + 1);
          if (($_FILES["uploaded_pic"]["type"] == "image/jpeg") && ($_FILES["uploaded_pic"]["size"] < 1000000)) {

                    //Code not uploaded

              } else {
              $message = "Im sorry you can only upload a JPG which is under 1MB in size.";
          }
      }
  }
?>

 

any ideas?

Link to comment
Share on other sites

excellent! Thank you so much.

 

Working (and now universal!) code:

 

$filetype = $_FILES["uploaded_pic"]["type"];
	  $acceptablefiletypes = array("image/pjpeg", "image/jpeg", "image/jpg");
          if (in_array($filetype, $acceptablefiletypes) && ($_FILES["uploaded_pic"]["size"] < 1000000)) {

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.