Rename temporary file in TemporaryFolder location

2 posts, 0 answers
  1. Lynne
    Lynne avatar
    25 posts
    Member since:
    Oct 2010

    Posted 19 Mar 2013 Link to this post

    I'm trying to rename the temporary file generated by RadAsyncUpload, but cannot find a property that contains the temporary file name value.  I thought there was a TemporaryFileName property on RadAsyncUpload which would allow me to do this, but I cannot find it.  Below is some basic code with my comments on what did not work.  Is it possible to rename the temporary file in the TemporaryFolder location before I move it to its final destination?  Thanks in advance.

     

     

     

    if (RadAsyncUpload1.UploadedFiles.Count > 0)

     

    {

     

     

     

    //This is the actual file name of the selected file, not the temporary file name in the TemporaryFolder directory, so this didn't work.

     

     

     

    string filename = Server.MapPath(RadAsyncUpload1.TemporaryFolder) + "\\" + RadAsyncUpload1.UploadedFiles[0].FileName;

    string outputFileName = "MyNewFile.pdf";

     

     

     

    string newFilename = Server.MapPath(RadAsyncUpload1.TemporaryFolder) + "\\" + outputFileName;

     

     

     

    //Now rename the file in the TemporaryFolder directory. This is a property on RadAsyncUpload.  Failed because filename did not exist.

     

     

     

     

     

     

     

    File.Move(filename, newFilename);

     

     

     

     

     

     

     

     

     

    }

     

     

     

  2. Lynne
    Lynne avatar
    25 posts
    Member since:
    Oct 2010

    Posted 19 Mar 2013 Link to this post

    I resolved this by using the following:

    RadAsyncUpload1.UploadedFiles[0].SaveAs(newFilename, true);

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top