Having trouble saving files to a specific location

4 posts, 0 answers
  1. Adam
    Adam avatar
    2 posts
    Member since:
    Jul 2013

    Posted 04 Jul 2013 Link to this post

    I have a form that has the following workflow.

    1. user fills out form, including optionally uploading a file
    2. the information gets saved to the database
    3. using the ID of the entry, a new folder is created with that ID number
    4. the file is uploaded to that folder
    5. the user is redirected to another page

    I can't seem to place the file uploading process in the right place.  Can someone point me in the right direction of the method to use?  Should I move the files in the button click action? Page load? onFileUpload?  
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 05 Jul 2013 Link to this post

    Hello,

    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" TemporaryFolder="TempFiles">
      </telerik:RadAsyncUpload>
      <asp:Button ID="Button1" runat=server Text="Button" onclick="Button1_Click" />

    protected void Button1_Click(object sender, EventArgs e)
       {
           //Perform insert operation and generate the ID
     
           string strID = "1";
     
           foreach (UploadedFile up in RadAsyncUpload1.UploadedFiles)
           {  
               DirectoryInfo dinfo = new DirectoryInfo(Server.MapPath("SpecificLocation/" + strID));
               dinfo.Create();
     
               up.SaveAs(Server.MapPath("SpecificLocation/" + strID)+"/"+ up.FileName);
           }
       }



    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    2 posts
    Member since:
    Jul 2013

    Posted 05 Jul 2013 Link to this post

    I think the issue I had ended up being that I was including a TargetFolder parameter in the RadAsyncUploader control, which was giving me an error when I tried doing the SaveAs bit.
  5. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 08 Jul 2013 Link to this post

    Hello,

    can you please provide error detail?

    Thanks,
    Jayesh Goyani
Back to Top