This is a migrated thread and some comments may be shown as answers.

How to get full path using RadAsyncUpload control

17 Answers 499 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Ravi Kumar
Top achievements
Rank 1
Ravi Kumar asked on 08 Jul 2010, 10:45 AM
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

17 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 08 Jul 2010, 03:58 PM
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
0
Robert H.
Top achievements
Rank 1
answered on 31 Dec 2010, 04:02 AM
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.
0
Genady Sergeev
Telerik team
answered on 05 Jan 2011, 10:47 AM
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.
0
Ananthakumar
Top achievements
Rank 1
answered on 11 May 2011, 03:37 PM
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
0
Genady Sergeev
Telerik team
answered on 16 May 2011, 06:00 PM
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.

0
Justin
Top achievements
Rank 1
answered on 20 Jun 2014, 04:43 AM
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.

0
Justin
Top achievements
Rank 1
answered on 20 Jun 2014, 04:59 AM
For others assistance, to get the client file path using the standard HtmlInputFile, you simply do ControlId.PostedFile.FileName

Regards,
Justin
0
Justin
Top achievements
Rank 1
answered on 20 Jun 2014, 05:41 AM
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.
0
gc_0620
Top achievements
Rank 1
answered on 18 Aug 2015, 04:34 PM

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>

 

0
Ivan Danchev
Telerik team
answered on 21 Aug 2015, 11:28 AM
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
0
gc_0620
Top achievements
Rank 1
answered on 21 Aug 2015, 02:05 PM
Thanks Ivan. For the time being I am going to stick with RadUpload.
0
Ivan Danchev
Telerik team
answered on 25 Aug 2015, 11:49 AM
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
0
Krishna
Top achievements
Rank 1
answered on 16 Feb 2018, 05:59 AM

FakePath issue - 

RadUpload control - alwayws shows fakepath when trying to access from client side in any browser.

Do we have any solution for this.

Thanks.

0
Peter Milchev
Telerik team
answered on 20 Feb 2018, 09:24 PM
Hello Krishna,

The modern browsers do not provide the full path of the uploaded file by the client as that would be a great security vulnerability.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jayavel
Top achievements
Rank 1
answered on 26 Oct 2018, 06:06 AM
Hi, I m using "telerik:RadAsyncUpload" for file upload. One of my requirement to get the uploaded file full path. Can any one help me whether i can able to get the full path using javascript or server side.
0
Marin Bratanov
Telerik team
answered on 26 Oct 2018, 09:36 AM
Hello jayavel,

Nothing has changed since Peter's reply earlier this year. Browsers do not let JavaScript touch or know about the file system on the client and this includes paths to files the user chooses to upload.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
jayavel
Top achievements
Rank 1
answered on 26 Oct 2018, 11:41 AM
Thanks Marin Bratanov. 
Tags
AsyncUpload
Asked by
Ravi Kumar
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Robert H.
Top achievements
Rank 1
Ananthakumar
Top achievements
Rank 1
Justin
Top achievements
Rank 1
gc_0620
Top achievements
Rank 1
Ivan Danchev
Telerik team
Krishna
Top achievements
Rank 1
Peter Milchev
Telerik team
jayavel
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or