SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Ballymena
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question move_uploaded_file : Mac/Safari

    I've coded a system which allows the upload of image files to a particular directory. This is all very well and good, and works fine - except when using Safari on a Mac.

    In this case, the tmp_name is the one being saved to the database i.e. the absolute path to the .tmp file e.g. "C:\php4\uploads\php4E5F.tmp". From Windows, it's fine. Anyone ever seen it or have any ideas?

    PHP Code:
    if ( ! is_dir$new_file_path ) )
    {
        
    mkdir$new_file_path );
    }

    if ( ( 
    $_FILES['logo_1']['type'] == "image/gif" ) || ( $_FILES['logo_1']['type'] == "image/pjpeg" ) )

        
    move_uploaded_file$_FILES['logo_1']['tmp_name'], $new_file_path $_FILES['logo_1']['name'] )  
            or die (
    "Could not save logo 1");
        
    $logo_1 $web_file_path $_FILES['logo_1']['name'];


    if ( ( 
    $_FILES['logo_2']['type'] == "image/gif" ) || ( $_FILES['logo_2']['type'] == "image/pjpeg" ) )

        
    move_uploaded_file$_FILES['logo_2']['tmp_name'], $new_file_path $_FILES['logo_2']['name'] )  
            or die (
    "Could not save logo 2");
        
    $logo_2 $web_file_path $_FILES['logo_2']['name'];

    Server is Win2K, PHP 4.3.10, ISAPI mode

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Ballymena
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quick bump - it appears it's not browser related. Same thing happening when using Firefox on Mac OS X - very bizarre...

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Ballymena
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What a nipple! Problem found. It appears that uploading a JPG file from different OS's means it gets a different type - which doesn't make any sense to me at all. Uploading from a PC, it gets an "image/pjpeg" type, but from a Mac it gets a "image/jpeg" type.

    Solved.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •