So I have a file upload site, which I develop using HTML5 chunking ability to upload multiple files. it works fine on Chrome, Firefox, IE (basicly browser with HTML5 capability) as well as Safari, but recently I test it out, Safari 6.0.5 works fine, but on Safari 6.1, If I upload multiple files, some files are 0 bytes. I'm not sure what happened.
When I tested, I upload about 70 files totalling 200MB, and each file is between 5-8MBish.. so there's no chunking happenening.. but when I check on the server, most file are 0 bytes (like it never get uploaded) except a few files (probably 3-5 files)
Is there any difference between Safari 6.0.5 and below, with Safari 6.1?
My code is basicly in a nutshell: Javascript will chunk each file if it's bigger than 10MB/file, if not it will just upload as is. then PHP will handle the upload (standard file upload style move_uploaded_file()).
function uploadFile(file_blob_chunk, file_name, file_part, total_file_chunk, file_id) {
//create a progress bar based on file id (check if it's the 0 part, otherwise there will be multiple bar for same file)
if(file_part == 0) {
progressBar(file_id);
}
//ajax call for creating multipart data form
fd = new FormData();
fd.append("file_for_upload", file_blob_chunk);
fd.append("file_id", file_id);
fd.append("file_name", file_name);
fd.append("file_part", file_part);
xhr = new XMLHttpRequest();
xhr.fid = file_id;
xhr.fid_name = file_name;
xhr.fid_part = file_part;
xhr.fid_total_chunk = total_file_chunk;
xhr.upload.fid = file_id;
xhr.upload.fid_part = file_part;
xhr.upload.fid_total_chunk = total_file_chunk;
xhr.open("POST", "datas/upload/" + file_name + '/' + file_part, true);
xhr.send(fd);
code wise it's something like that...
any idea what's wrong with safari 6.1?
I check the tmp folder, the tmp file during upload is 0 bytes..
NOTE: Safari 6.1+, If web inspector on, every file is uploaded correctly, if it's off, out of 10 files, only 3 got uploaded the rest is 0 bytes. what cause this difference?