Restricting open dialog box to certain files using javascript
When uploading photos and videos, the open dialog box should default to file su开发者_JAVA技巧ffixes that are relevant. e,d when i uploading images, it should show only file with extension .jpeg, jpg, gif, png, bmp etc. And same with videos..
Thanks.
You can't do that with JavaScript (possibly for security reasons). The "open file" dialog is handled by the browser's <input type="file">
control and not by JS code.
If it's an absolute necessity, consider a Java or Flash uploader applet - you'd have much more control over the UI there.
精彩评论