Rank: Advanced Member Groups: Member
Joined: 3/18/2008 Posts: 41
|
Hi. AjaxUploader: Is there a way to open the file dialog using javascript? I have tried to simulate a click on the "Browse" button, but it does not open the file dialog.
Code: JavaScript
document.getElementById('ctl00_ContentPlaceHolder1_AJAXUploaderPicture_BrowseButton0').click();
Is there another way to open the file dialog from javascript? HT
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I am not sure if that's possible. One of the security principle for file upload is that user must initiate the upload (by clicking the browse button to browse a file) so that user is well aware of that he/she is sending one of his own files to the server. Because of this, the file input element exposes very little functionalities through JavaScript. I know for sure that you can not "pick a file" for the user with JavaScript. I am not sure whether you can open the dialog with JavaScript.
Implementations that need to overcome these limitations are generally based on plug-in based technologies, such as Flash or ActiveX. Since our uploader is pure JavaScript and DHTML, so it currently only does what DHTML/JavaScript can do.
Thanks!
|