Reuploading the same file

Thread is closed for posting
4 posts, 1 answers
  1. Arun
    Arun avatar
    2 posts
    Member since:
    Feb 2011

    Posted 02 Feb 2011 Link to this post

    Hi,

    I am using a RADFileUpload control. The file is first uploaded into a temporary location by the file upload control. From this temp location, my code copies this file into a repository. Once the file is copied into the repository, the temp file will be deleted automatically by the upload control. This is working fine with small files(upto 500MB). But for large files(1GB), when the file is being copied into the repository the uploader reuploads the same file into the temporary location rather than waiting for the copy process to complete and delete the temporary one. I am not sure why this is happening. Could you please help me to solve this issue?

    Thanks,
    Arun
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 04 Feb 2011 Link to this post

    Hello Arun,

    I don't believe that this is an issue connected with RadUpload. RadUpload will not re upload the files in any circumstances (unless the page is explicitly refreshed using F5). What is the code that you use to move the file to the repository?


    Greetings,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Arun
    Arun avatar
    2 posts
    Member since:
    Feb 2011

    Posted 04 Feb 2011 Link to this post

    Hi,

    I have used FileStream to copy the file to the repository. My code looks something like this

    public static void CopyStream(Stream inputStream, String fileName)
    {
           FileStream outPutFile = File.OpenWrite(fileName);
           int bufferSize = 32768;
        byte[] buffer = new byte[bufferSize];
       
    int bytesRead = 0;
        while ((bytesRead = inputStream.Read(buffer, 0, bufferSize)) 0)
               dest.Write(buffer, 0, bytesRead);
      
       
    inputStream.Close();
            outPutFile.Close();
            inputStream.Dispose();
            outPutFile.Dispose();
    }

    Could you please help me as i am a newbie in ASP.Net?

    Thanks,
    Arun
  5. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 04 Feb 2011 Link to this post

    Hello Arun,

    If all your doing is saving the file to a specific file name, you don't need to read the UploadFile's InputStream object, you can just call the SaveAs method. Like so:

    RadUpload1.UploadedFiles[0].SaveAs(fileName);

    That's all you need to do to save a file. In the line above I'm saving the first uploaded file.

    I hope that helps.
Back to Top