neurofuzzy, flash game development, rich internet applications, free source code - *alt.neurotica.fuzzy*

neurofuzzy, flash game development, rich internet applications, free source code - *alt.neurotica.fuzzy*

4/24/2006

Safari, PHP, and File Uploads

Filed under: PHP — geoff @ 10:29 am

Okay, so I’ve searched the web high and low and have been unable to find a solution for found a solution for this problem. (There may be a solution at “experts exchange”, but I refuse to pay to see their “solution”.) I’ve got an image upload form on my site… a typical web form. It works fine in all browsers except Safari. In Safari, the upload quits immediately, and the form handler says nothing was submitted.

I think this is a problem with the way Safari submits multipart form data. PHP can’t handle it and pukes. I see a lot of posts out there about this… people are complaining that this doesn’t work, however I see nothing on Apple’s site, nor any actual solutions posted.

Safari uploads fine on Flickr, and there’s nothing special about the way they coded their form on the front-end. They are using CGI (perl?) on the backend, though. Has anyone run into this problem, and found a solution? Oh, and if you post it, I promise not to make people pay to see it. ;)

11 Comments »

  1. I had a similar problem before - someone told me to see if I could access the php://input “stream” to read the raw data posted from the form.

    I never had to implement this. so sorry if that is not much help. I will look more when I get home from work.

    Comment by Glen Pike — 4/24/2006 @ 11:49 am

  2. Hi,

    I maintain several websites (all running PHP 4.x in linux) and am often uploading data via Safari without problem. What website, Safari version, PHP version, .etc?

    Comment by Miles — 4/24/2006 @ 11:59 am

  3. I’m running PHP 4.3.1 and the latest Safari. You know, I just realized that Wordpress has no problem uploading files… so it must be something with the way I coded the backend? Or perhaps because I’m accepting multiple file inputs as opposed to 1?

    Comment by geoff — 4/24/2006 @ 12:48 pm

  4. well, since you bring up multiple file upload, i’m not sure if you are aware of this or not but the $_FILES array in php will be structured a little bit differently if you are uploading multiple files at one time.

    http://us3.php.net/manual/en/features.file-upload.multiple.php

    Comment by flashape — 4/24/2006 @ 4:14 pm

  5. Had the same problem two or three weeks ago. Multiple files aren’t a problem usually. Are the files you’re uploading very big? I thought that the server would have at least started streaming first but it stopped immediately. I upped the post_max_size and upload_max_filesize. I hope I remember the solution right, had several problems with uploads but I think that was what fixed the upload stopping immediately.

    Comment by jg — 4/24/2006 @ 4:53 pm

  6. Oh, that was shite what I posted if it worked with different browsers before. So obviously not the problem. I’ll try and remember what I did and get back to you.

    Comment by jg — 4/24/2006 @ 4:56 pm

  7. Flashape,

    Yes, I know… it works in every other browser, so I’m pretty sure that’s not the issue. It just seems like Safari is aborting the upload for some reason… or more likely, PHP doesn’t see what is being sent and aborts the process.

    The odd thing is that this Wordpress install works fine, and it’s on the exact same config.

    Comment by geoff — 4/24/2006 @ 5:22 pm

  8. Why you won’t take the Ethereal which is an excelent tool for these kind of problems when you really don’t have any clue on what happens in the communication layer and try to see where the problem reside?

    I always do this when I suspect browser-PHP communication bugs. Try uploading same file (a small image of 1k) on IE or Firefox then into the Safari and compare the results . It is pretty straight forward Start->Capture then after the page finish reloading into the browser click the stop, identify your request on the server (POST /page.php). Right click on it and in the menu choose Follow TCP/IP Stream.

    I hope it helps

    Comment by Cristian MARIN — 4/25/2006 @ 5:03 pm

  9. Just wanted to send my sympathies, I have the same problem. Haven’t tested the ethereal solution though.

    I have tries php 5.1.2 with ligthttpd (fastcgi) and apache 2.2.X with php 5.1.5 (so-module). The problem exists in both setups.

    Comment by Anders — 9/15/2006 @ 3:06 am

  10. Note this problem was solved. The post is here. Thanks!

    Comment by geoff — 9/15/2006 @ 2:20 pm

  11. Too bad I didn’t read this earlier. I also found the same bug/solution you did. (About display=none) But on the bright side, I learned a bit about tcpdumping =)

    Comment by Anders — 9/25/2006 @ 7:11 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

 

Powered by WordPress