How to get full path using RadAsyncUpload control

13 posts, 0 answers
  1. Ravi Kumar
    Ravi Kumar avatar
    37 posts
    Member since:
    May 2010

    Posted 08 Jul 2010 Link to this post

    Hi,
     I am using RadAsyncUpload control for select a image file from physical path like "D:/Mypicture/pic1.jpeg" and I want to get the full physical path means ‘D:/Mypicture/pic1.jpeg’ but I haven’t get the full path using RadAsyncUpload control.
    Below is my code :-
    .aspx
    <telerik:RadAsyncUpload runat="server" ID=" RadAsyncUpload " ReadOnlyFileInputs="false" Width="225px" MaxFileInputsCount="1" OverwriteExistingFiles="true"> </telerik:RadAsyncUpload>

    .cs
    foreach (UploadedFile file in RadAsyncUpload.UploadedFiles)
    {
    String fullpath = file.FileName;
    }
    Using this code I got only image name i.e. ‘pic1.jpeg’

    Please help!

    Regards
    Ravi
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 08 Jul 2010 Link to this post

    Hello Ravi Kumar,

    You cannot obtain the full client path using RadAsyncUpload. Keep in mind that this is the path on the client machine. Why do you need that on the server? The reason that the client path is not available is that only IE 6 & 7 provide the path. All other browsers provide only the file name of the file selected. Since our goal is to achieve consistent behavior across the different browsers we have decided to stick to the behavior that all major browsers follow.

    I see that the IntelliSense shows that FileName returns the fully qualified path on the client. We will fix the message displayed by  intellisense so that it reflects the actual functionality.

    Kind regards,
    Genady Sergeev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robert H.
    Robert H. avatar
    2 posts
    Member since:
    Mar 2010

    Posted 30 Dec 2010 Link to this post

    Just letting you know that in the latest release version 2010.3.1109.40 the Intellisense still shows it having the full path and not just the file name.

    Thank you.
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 05 Jan 2011 Link to this post

    Hello Ravi Kumar,

    We will address the issue in the next service pack. I've updated your telerik points for the report.

    Greetings,
    Genady Sergeev
    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.
  6. Ananthakumar
    Ananthakumar avatar
    1 posts
    Member since:
    Nov 2010

    Posted 11 May 2011 Link to this post

    Hi

    We have a peculiar requirement for which we need to get the full path of the uploaded files form the async upload. We need to pass the full file path from the client machine to the server, and the server communicates directly to the client through an agent installed in the client system and picks up the files and stored in the server. This actually avoids the limitation of the web content length as we only pass the instruction to the server and the server picks up the files directly from the client through the network.

    To achieve this multiple file upload scenario, we have used the async upload control.

    Please let me know if there is any way either in the client using javascrips or any other technique from the server side by which we can get the full local path of the file.

    Thanks in advance.


    Regards,
    Ananth
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 16 May 2011 Link to this post

    Hi Ananth,

    Unfortunately, the full path is no longer provided by the browsers due to a security reasons. The only thing we are given is the file name. Only IE6 and IE7 will provide the full name, all other browser will truncate it 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.

    Unfortunately there is nothing we can do in order to change this behavior.

    Best wishes,
    Genady Sergeev
    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.

  8. Justin
    Justin avatar
    9 posts
    Member since:
    Dec 2013

    Posted 19 Jun 2014 in reply to Genady Sergeev Link to this post

    I have the same requirement, to get the full client path.  I'm using IE8, and the standard file upload control is able to grab the full path.  I attached a screen shot of this, I know it works because I'm inserting that path into a database from a web server.

  9. Justin
    Justin avatar
    9 posts
    Member since:
    Dec 2013

    Posted 19 Jun 2014 in reply to Justin Link to this post

    For others assistance, to get the client file path using the standard HtmlInputFile, you simply do ControlId.PostedFile.FileName

    Regards,
    Justin
  10. Justin
    Justin avatar
    9 posts
    Member since:
    Dec 2013

    Posted 20 Jun 2014 in reply to Justin Link to this post

    Turns out you can get the filename.  To do so, create a HiddenField control, and add following js function:

    function rAsyncUpload_Selected(sender, args) {
    document.getElementById('<%= hidValueFilePath.ClientID%>').value = args.get_fileName();
    }

    On your RadAsyncUploadControl, set DisabledPlugins="true", and add in:
    OnClientFileSelected="rAsyncUpload_Selected"

    For your fileuploaded control, you can read the value of your HiddenField to pull out the client's full path.
  11. gc_0620
    gc_0620 avatar
    225 posts
    Member since:
    Feb 2008

    Posted 18 Aug 2015 Link to this post

    I also have the same requirement also. I can get the Full path using RadUpload or Stand dard Asp.net file upload control. Unfornuately can't get the same result set using  RadAsyncUpload. B/c of Due to some security restrictions.

    How is possible it works in other 2 controls except  RadAsyncUpload? Is there any other work around (i.e. store the Full Path in Session variable etc???) Below is my code declaration. Thanks

    function RadUpload1_Selected(sender, args)
     {
     
           var upload = $find("<%= RadUpload1.ClientID %>")
           var filePath = upload.getFileInputs()[0].value;
           var fileName = filePath.substring(filePath.lastIndexOf("\\") + 1);
           alert(filePath);
           alert(fileName);
     }
     function AsyncUpload_Selected(sender, args) {
           var currentFileName = args.get_fileName();
           alert(currentFileName);
     }
     
    <telerik:RadUpload ID="RadUpload1" OnClientFileSelected="RadUpload1_Selected" Width="500px" MaxFileInputsCount="1" MaxFileSize="50971520"
                AllowedFileExtensions="csv" ControlObjectsVisibility="RemoveButtons" runat="server" Skin="Silk">
            </telerik:RadUpload>
     
    <br />
     <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions="csv" MultipleFileSelection="Disabled"
                DisabledPlugins="true" OnClientFileSelected="AsyncUpload_Selected"
                MaxFileSize="50971520" Skin="Silk" UploadedFilesRendering="BelowFileInput" >
    </telerik:RadAsyncUpload>

     

  12. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 21 Aug 2015 Link to this post

    Hello,

    As Genady pointed out in his last post only IE6 and IE7 will display the full path while the newer browsers do not allow this for security reasons.

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  13. gc_0620
    gc_0620 avatar
    225 posts
    Member since:
    Feb 2008

    Posted 21 Aug 2015 in reply to Ivan Danchev Link to this post

    Thanks Ivan. For the time being I am going to stick with RadUpload.
  14. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 25 Aug 2015 Link to this post

    Hello,

    While in Chrome and Firefox both controls behave identically and do not return the full path, currently the RadAsyncUpload cannot return the full path in IE11, but RadUpload can so if this capability in IE11 is critical in your scenario you can use RadUpload. 

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017