Welcome to WebmasterWorld Guest from

Forum Moderators: travelin cat

Message Too Old, No Replies

safari upload woes

webkit upload quirk



9:02 pm on May 16, 2007 (gmt 0)

5+ Year Member

Just wanted to share some tribulations I had trying to get my html upload form working in safari. There is an old post on webmaster world that also covers these issues and correctly points out that if you use display=none to hide your file inputs before you submit your form, the files will not be posted. This is mostly true and the same thing happens if you set visibility to hidden. The post incorrectly states that this happens when your display value change is placed in the function called by your form's onSubmit event handler and states that a fix for this problem is to place the display value change in an onclick event for your submit button. A fix that does work is simply submitting the form first and then changing the display value. ex:

works in Safari:

fileInputObjToHide.style.display = 'none';

doesn't work in safari:

fileInputObjToHide.style.display = 'none';

The older post also references an article stating that safari can hang 30-40 percent of the time when you upload. I haven't looked into that one that much except to say I tried the solution in the post (using a connection close http header on the form page) and it didnt work. anyone known of a fix for this? at the moment i'm using php and in lieu of posting a lot of code heres the headers im sending (most are to prevent caching):

header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header('Connection: close');


1:37 pm on May 24, 2007 (gmt 0)

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Thanks for sharing your experience, roshi_is_ok! :)

And, Welcome to WebmasterWorld [webmasterworld.com]!


Featured Threads

Hot Threads This Week

Hot Threads This Month