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

Save file in to folder by coding

1 Answer 64 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 2
Deepak asked on 17 Jan 2011, 07:08 AM
Hi,
plz give me a small example how can i am save the file in the project folder by using radupload control through coding in c#.
I have already using
Default.aspx
<telerik:RadUpload ID="imageUpload" runat="server" ControlObjectsVisibility="None"
                                         MultipleFileSelection="Disabled"
                                        AllowedFileExtensions=".jpg,.jpeg,.png,.gif" TargetFolder="~/Record/">
                                    </telerik:RadUpload>
Default.aspx.cs
if (imageUpload.UploadedFiles.Count>0)
 
               {
                    
                  // Guid guid = new Guid();
                   string filename = Guid.NewGuid().ToString() +imageUpload.UploadedFiles[0].GetExtension();
                   testimonial.FileName = filename;
                   testimonial.FileUrl = "~/Record/" + filename;
                   filename = Server.MapPath("~/Record/" + filename);
                   imageUpload.UploadedFiles[0].SaveAs(filename);
                   testimonial.FilePhysicalPath = filename;
                    
                    
               }
But always imageUpload.UploadedFiles.Count property show 0 file upload .
Please help me asps.
Thanks

1 Answer, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 17 Jan 2011, 02:13 PM
Hello Deepak,

In your RadUpload control declaration, remove the TargetFolder property because I'm assuming the control is automatically saving the file, thus the reason why the UploadedFiles collection's length is 0.

I hope that helps.
Tags
Upload (Obsolete)
Asked by
Deepak
Top achievements
Rank 2
Answers by
Cori
Top achievements
Rank 2
Share this question
or