Save file in to folder by coding

Thread is closed for posting
2 posts, 0 answers
  1. Deepak
    Deepak avatar
    9 posts
    Member since:
    Aug 2010

    Posted 17 Jan 2011 Link to this post

    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
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 17 Jan 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top