I have a requirement in my project to select a file from local machine
when a button is clicked, user should see a browser window to choose a file,
and user can select only one file, and user should be accessible to all the drives,desktop as in windows browser
and finally we need the selected file path with file name to manipulate that file.
Can you pls provide the code for this, I am working on this almost one week but unable get the solution
4 Answers, 1 is accepted
For this scenario you could use RadAsyncUpload control. It covers these requirements. Here is the code you can use:
In the code above AllowedFileExtensions property allow you to specify which files types user can select. Other property HideFileInput displays control as a button. Finally uploaded file can be manipulated on the server in OnFileUploaded event.
Additional resources you may find for useful:
- RadAsyncUpload Online Demos
- RadAsyncUpload Online Documentation
- Getting Started with RadAsyncUpload on Telerik TV
And the file should not be uploaded ,i need only the path of the file to manipulate
Canyou pls help me
Unfortunately, the full path is no longer provided by the browsers due to a security reasons. This is the default behavior. Only IE6 and IE7 provide the full name along with the path and in all other browsers it is truncated to:
1) Only file name (Chrome/Safari)
2) C:\fakepath in IE/Opera
3) Full path displayed - FireFox, however, only filename is sent to the server.
Suppose you want to open the Open File browser dialog on a button click, you can display the Select button of the RadAsyncUpload alone and hide the textbox by setting the HideFileInput property of the control to true.
Shinu is right, different browsers show very limited information. It is a security restriction.