FileReference won't accept PNG on Mac
I have a little problem with a FileReference which I use to let users sele开发者_如何学Pythonct a File from their computer and upload it to a server.
I only allow PNG and JPEG files to be uploaded which I defined for all windows computers using the FileFilter via the constructor. The problem is that mac systems (or unix in generell) don't only use the file extension but also read some file type in the header of a file I think.
That is what the property macType is for on the FileFilter class in AS3.
var fileFilter:FileFilter;
fileFilter = new FileFilter("PNG, JPG", "*.jpg;*jpeg;*png");
fileFilter.macType = "JPEG;jp2_;PNGf";
var fileReference = new FileReference();
fileReference.addEventListener(Event.SELECT, onFilesSelected);
fileReference.browse([fileFilter]);
So my problem is that users on a Mac can only select JPG Files and Mac won't allow PNG Files. Does anybody know the right macType or am I missing something?
You are missing a period in your descriptor:
new FileFilter("PNG, JPG", "*.jpg;*.jpeg;*.png");
精彩评论