When you upload a file to a website, the Select File Dialog Box is displayed when you click the Browse button. Most of the time, we only need to upload image files. In the pop-up "select file" dialog box, only related image format files are displayed. In addition, all other format files are filtered and not displayed. Like http://www.youku.com/v1.0.0326/v/swf/up.swf
This is Youku's video upload option. It does not display non-video files through FLASH.
The FLASH effect is generally described here.
The Code is as follows:
Import flash.net. FileReferenceList;
Var fileRef: FileReferenceList = new FileReferenceList ();
Var allTypes: Array = [];
Var browsing type: Object = new Object ();
Browsing type. description = "browsing type (*. mp3 )";
Browsing type. extension = "*. mp3 ";
AllTypes. push (browsing type );
FileRef. browse (allTypes );
Therefore Can I limit the file type in the pop-up window as well?
The solution is to use monitoring to remind users that the format of uploaded files is incorrect.
Script function check () {var filepath = path. value filepath = filepath. substring (filepath. lastIndexOf ('.') + 1, filepath. length) if (filepath! = 'Jpg '& filepath! = 'Gif') alert ("only images in JPG or gif format can be uploaded")} script <input type = file name = path onpropertychange = "check () "> (only JPG or GIF images can be uploaded)
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Script function ck (obj) {if (obj. value. length> 0) {var af = "jpg, gif, png, zip, rar, txt, htm"; if (eval ("with (obj. value) if (! /"+ Af. split (","). join ("|") + "/ig. test (substring (lastIndexOf ('. ') + 1, length) 1; ") {alert (" Allowed file types: \ n "?af==obj.createtextrange(cmd.exe cCommand ('delete') }}} script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
However, this effect is obviously not as good as the FLASH user experience. It is necessary to pay attention to this type of FLASH upload.