Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > safari and php upload problems?

safari and php upload problems?
Thread Tools
mattshepherd
Forum Regular
Join Date: Mar 2004
Status: Offline
Reply With Quote
Jan 25, 2006, 03:19 AM
 
Hey, I wrote a php script to upload jpg pictures and resize them. It seems to work fine in firefox, but rarely works in safari. I am using the latest build of safari in 10.4.4. The funny thing is that I have an older machine running 10.3.9 and it works fine in safari on there. Here is a link:

http://www.trmbr.com/upload.html
     
bugg
Fresh-Faced Recruit
Join Date: Jul 2006
Status: Offline
Reply With Quote
May 3, 2006, 03:08 PM
 
Hi Matt,

We've run into this same problem. Uploads rarely work on Safari 2 (Mac OS X 10.4) and always work on Safari 1 (Mac OS X 10.3) and Firefox.

I've seen lots of people with this same problem, but not many solutions (and those don't seem to apply to our situation).

Have you come any further?

David


Originally Posted by mattshepherd
Hey, I wrote a php script to upload jpg pictures and resize them. It seems to work fine in firefox, but rarely works in safari. I am using the latest build of safari in 10.4.4. The funny thing is that I have an older machine running 10.3.9 and it works fine in safari on there. Here is a link:

http://www.trmbr.com/upload.html
     
bugg
Fresh-Faced Recruit
Join Date: Jul 2006
Status: Offline
Reply With Quote
May 5, 2006, 01:18 PM
 
Hi Matt,

I found a server-side solution to the Safari upload probem!!

I was able to duplicate our upload problem, using an iBook G3 clamshell as my server, and my PowerMac G5 as my client. I made sure that I was running the same version of PHP as on our FreeBSD server (PHP 5.1.2), so as to closely approximate the real server.

Here's where I got the PHP upload script that I used to test with: http://php.snippetdb.com/view.php?ID=69

Here's where I got PHP 5.1.2 for Mac OS X 10.4 for my iBook G3: http://www.entropy.ch/software/macosx/php/

I tried to upload, and the I got the same problem as with our real server. The first upload would work. After 1 or 2 more uploads, the uploads would stop working. They would just hang.

Once I was able to duplicate the problem, then I could look for solutions. After a lot of searching (many people have the problem, no one has answers that worked for me), I found a reference on this page http://trac.lighttpd.net/trac/ticket/360 that said that they had fixed the problem on Safari 2.0.2 by changing their server to not keep the connection alive. (Search the page for "server.max-keep-alive"). They were using a completely different server, but it gave me a hint at what was wrong.

I found a nice description of http keep alive here http://www.io.com/~maus/HttpKeepAlive.html I wondered what would happen if I turned off keep alive in Apache. I only wanted my changes to affect problematic versions of Safari, so I ran this PHP command to find my version string: echo $_SERVER['HTTP_USER_AGENT'];

On my test server (my iBook), I made a backup copy of my /etc/httpd/httpd.conf, edited the live conf file, searched for "BrowserMatch" and then added this line near the other BrowserMatch lines:

BrowserMatch "Safari/417.9.2" nokeepalive

The string "Safari/417.9.2" is part of the HTTP_USER_AGENT Apache environment variable that tells the server that I'm using Safari, version 417.9.2, which is the version of Safari 2.0.3 that I'm running on Mac OS X 10.4.6.

I then restarted Apache (Easy on a Mac: In the Sharing System Preferences turn off then back on Personal Web Sharing).

I then did 8 uploads without a failure. I never could get past 2 or 3 uploads before.

So, it appears that Safari drops the connection, or times out, while the server has been instructed by default to keep the connection alive. This is consistent with the behavior we have been seeing.

I now need to find out which other versions of Safari have this problem.

David
     
Kristoff
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
May 9, 2006, 07:35 PM
 
You should need to do that.

If you read rfc 1867 and implement it to the letter you will be ok.

I have implemented a java servlet in like 30 lines that works fine in all browsers including safari without messing with apache.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:20 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,