PDA

View Full Version : FileReferenceList upload IOError on Mac


salzbermat
10-25-2005, 08:13 AM
We have a filereference upload set up and working uploading to a PHP script
on an apache server.
It's a multiple upload script with FileReferenceList and a PHP script that
moves the files and inserts to database.
The file upload works well using Win XP (IE, Firefox, Opera).
On the Mac (safari, Firefox), we get IOErrors, the files won't upload. There
is no authentication necessary, nor are there any restrictions for filenames
etc. as the documentation suggests. We're not starting sessions, as we got
errors that way, too. We tried on several machines all with latest flash
player installed, it works on the PC, doesn't on the mac.
We tried on two different servers, I even removed all PHP code from the
upload script just to make sure it's not a server-side problem, so obviously
there is something awkward happening on the Mac.

Any suggestions?
Thanks,
Bernd

cg_flipper
01-09-2007, 08:47 PM
anyone have a solution to this... i've pinpointed the problem to file names containing spaces on the mac

kalbster
02-26-2007, 02:30 PM
You can check the filename before the user uploads. Alert the user if a file contains unwanted ascii characters such as a space. I had the same problem with mac users. This is also useful if you have people uploading files from different countries that may contain characters in a different character set.



function checkFileName(filename:String):Boolean{
trace("*** checkFileName() ***: " + filename);

//var fileNameNoExt:String = getFileName(filename);
var fileNameNoExt:String = filename;
trace("fileNameNoExt: " + fileNameNoExt);

var nameOK:Boolean = true;

for (var i:Number = 0; i < fileNameNoExt.length; i++) {

if ((fileNameNoExt.charCodeAt(i) >= 97 && fileNameNoExt.charCodeAt(i) <= 122)
|| (fileNameNoExt.charCodeAt(i) >= 65 && fileNameNoExt.charCodeAt(i) <= 90)
|| (fileNameNoExt.charCodeAt(i) >= 48 && fileNameNoExt.charCodeAt(i) <= 57)
|| fileNameNoExt.charCodeAt(i) == 95 || fileNameNoExt.charCodeAt(i) == 45 || fileNameNoExt.charCodeAt(i) == 46 || fileNameNoExt.charCodeAt(i) == 32){
//trace(fileNameNoExt.charAt(i));
}
else {
nameOK = false;
trace("ERROR @ " + i + " STRING: " + fileNameNoExt.charAt(i));
showAlert("Bad Character", "The '" + fileNameNoExt.charAt(i) + "' character is not allowed. \nPlease change the name of file: " + filename + " and try again.")
i = fileNameNoExt.length;
}//end if

}
return nameOK;
}//checkFileName(filename:String)



public function onSelect(ufile:flash.net.FileReferenceList) {
...
if(checkFileName(ufile.fileList[i].name)){
//this is a vaild file do something with it.
}
...
}