Welcome to WebmasterWorld Guest from 54.198.118.102

Forum Moderators: travelin cat

Message Too Old, No Replies

safari upload woes

webkit upload quirk

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

New User

10+ Year Member

joined:May 16, 2007
posts:1
votes: 0


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:

formObj.submit();
fileInputObjToHide.style.display = 'none';

doesn't work in safari:

fileInputObjToHide.style.display = 'none';
formObj.submit();

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):

<?php
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)

Senior Member from US 

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

joined:Dec 9, 2003
posts:3416
votes: 0


Thanks for sharing your experience, roshi_is_ok! :)

And, Welcome to WebmasterWorld [webmasterworld.com]!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members