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

File Upload control inside the rad grid (not working)

6 Answers 395 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prassin
Top achievements
Rank 1
Prassin asked on 14 Sep 2012, 04:50 AM
Hi All,

I have a file upload control inside the rad grid.. when i try to upload a file using file upload its not working properly.. i wish to retrieve the file path on my code behind.... please help 

Regards,
Prassin

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Sep 2012, 07:11 AM
Hi,

I am not quite sure where you are placing the control. Here is the sample code that I tried to retrive the file path in EditItemtemplate of a RadGrid.
C#:
protected void Radgrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = (GridEditableItem)e.Item;
    FileUpload upload = (FileUpload)item.FindControl("FileUpload1");
    if (upload.HasFile)
    {
        string path = upload.PostedFile.InputStream.ToString();
    }
}

Thanks,
Shinu.
0
Prassin
Top achievements
Rank 1
answered on 14 Sep 2012, 08:10 AM
Hi Shinu,

Thanks for your replay,, but this code is not working in my side.. its shows nothing,,, il you please clarify the issue,,

Regards,

Prassin
0
Radoslav
Telerik team
answered on 19 Sep 2012, 05:56 AM
Hello Prassin,

Please check out the following forum posts which elaborate on the same matter:

http://www.telerik.com/community/forums/aspnet-ajax/async-upload/how-to-get-full-path-using-radasyncupload-control.aspx
http://www.telerik.com/community/forums/aspnet-ajax/upload/how-to-get-full-path-in-radupload.aspx

I hope this helps.

All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Prassin
Top achievements
Rank 1
answered on 19 Sep 2012, 06:08 AM
Hi Radoslav,

thanks for your replay,, you are telling about rad upload.. i know it il not work properly here so i put the asp file upload control..
i am used this code.

 
Dim insertItem As GridEditFormInsertItem = TryCast(e.Item, GridEditFormInsertItem)
   Dim upload As FileUpload = DirectCast(insertItem.FindControl("upload"), FileUpload)
If upload.HasFile Then
   Dim path As String = upload.PostedFile.InputStream.ToString()
End If
 
but this code not working.. when click the insert button the file upload control posted file and url state change to "Nothing".. i think some post back is working there... this same issue i have faced on rad window.. when the file upload control inside the rad window then it il not work as the same., getting same error.. please have clarify that if it is possible or not..

please have notice the above posted comment from Mr: Shinu.

Regards,

Prassin
0
Radoslav
Telerik team
answered on 21 Sep 2012, 06:33 AM
Hello Prassin,

The upload.PostedFile.InputStream is a Stream object and calling the ToString() method will not return the uploaded file path.
You cannot obtain the full client path using RadUpload  or RadAsyncUpload. Keep in mind that this is the path on the client machine. 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.
The FileUpload also does not support getting full path. More information you could find here:
http://forums.asp.net/t/1077850.aspx/1
http://weblogs.asp.net/ashicmahtab/archive/2009/05/20/fileupload-control-doesn-t-give-full-path-help.aspx
http://www.codeproject.com/Questions/329421/get-full-path-of-file-using-fileupload-control
http://stackoverflow.com/questions/1130560/get-full-path-of-a-file-with-fileupload-control

All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Prassin
Top achievements
Rank 1
answered on 21 Sep 2012, 07:03 AM
Hi Radoslav,

Thanks for your valuable replay,,

Regards,

Prassin
Tags
Grid
Asked by
Prassin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Prassin
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or