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

Reuploading the same file

3 Answers 54 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Arun
Top achievements
Rank 1
Arun asked on 02 Feb 2011, 06:57 PM
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

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 04 Feb 2011, 09:43 AM
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.
0
Arun
Top achievements
Rank 1
answered on 04 Feb 2011, 06:36 PM
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
0
Accepted
Cori
Top achievements
Rank 2
answered on 04 Feb 2011, 08:33 PM
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.
Tags
Upload (Obsolete)
Asked by
Arun
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Arun
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Share this question
or