Open File Question

2 posts, 0 answers
  1. Tom
    Tom avatar
    41 posts
    Member since:
    Feb 2009

    Posted 12 Apr 2011 Link to this post


    I am writing an application in which I want to browse a default UNC path (and subdirectories) to select a file, at which point the file path and name would reside in the text box  (standard text box and button to browse for a file).  I want the allowed file extensions that may be viewed to be CSV,TXT and do not want the user to see any other extensions when browsing for a file.

    I do not need to actually upload the file, as my process would be to take the contents of the text box containing the file path and name and store that info into a table (there is a back-end process that will pick up the file and load it).

    I am not sure which control to use (asyncupload, upload, or filelocation) since I only need to select the file.

    Is there an example of something like what I am attempting to do and a recommendation for the type of control?

  2. Peter Filipov
    Peter Filipov avatar
    1028 posts

    Posted 15 Apr 2011 Link to this post

    Hello Tom,

    For security reasons browsers don't allow you to take the full file path. It is possible to take only the file name. Also, for the same reasons it is not possible to browse and select a file using javascript. The user should manually select a file from a location. All these are browser's limitations and it is not possible to workaround them.

    On the other hand, even If it was possible to grab the path and then save it, please have in mind that this is the path to the file on the client machine. The server is a different machine and this path is not applicable to it. I mean that you can't load the files from the server using the path that was available on the client.

    Apart from this, you can use RadAsyncUpload to filter the file choice by setting AllowedFileExtensions property. 

    All the best,
    Peter Filipov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top