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

Could not find file after refresh page

7 Answers 542 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
mastermehdi
Top achievements
Rank 2
mastermehdi asked on 05 Jul 2010, 08:34 PM

hi

after upload a file and save it, when i refresh page with browser refresh button, this error showing:

System.IO.FileNotFoundException: Could not find file 'G:\Project\realpanacea\banners\temp\s0jenl45.iw4'.

is this a bug?

How I can fix it?

7 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 06 Jul 2010, 10:03 AM
Hello mehdi ghasemi,

We are not able to reproduce such exception on our online demos. What version of the controls do you use? Can you please paste here the mark-up of the page that fails and any relevant code-behind. Thank you.

Best wishes,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
mastermehdi
Top achievements
Rank 2
answered on 09 Jul 2010, 08:30 AM

this is may codes:

1.<telerik:RadAsyncUpload ID="rauView0BannerFile" runat="server" />
2.<asp:Button ID="btnView0Upload" runat="server" OnClick="btnView0Upload_Click" />
1.protected void btnView0Upload_Click(object sender, EventArgs e)
2.{
3.    rauView0BannerFile.UploadedFiles[0].SaveAs(MapPath("~/files/") + rauView0BannerFile.UploadedFiles[0].FileName, true); 
4.}
when i upload a file and click on submit button it is work fine

but after this when i refresh page with browser refresh button this error showing:

System.IO.FileNotFoundException: Could not find file 'G:\Project\realpanacea\banners\temp\cty4m5l2.w0q'.

i attach full error report

i test it in all browsers

and my controls version is:2010.1.309.35

0
Genady Sergeev
Telerik team
answered on 14 Jul 2010, 11:58 AM
Hello mastermehdi,

This is expected. As the file is once saved, its temporary file counterpart is deleted. When you refresh the page the browsers repeats the last action, however, there is no longer temp file. Hence the error. Why do you need to refresh the page?

Best wishes,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
mastermehdi
Top achievements
Rank 2
answered on 15 Jul 2010, 06:38 PM

i don't need to refresh page but i don't want show this error to user and RadAsyncUpload do not have a peropertis or function for checking that temp file deleted or not.

So what should we do?

0
Genady Sergeev
Telerik team
answered on 16 Jul 2010, 04:03 PM
Hello mastermehdi,

You can wrap the SaveAs invocation inside Try/Catch and then, in the Catch clause, update a label that says the temp files has already been deleted. Here is some example code:

try
{
rauView0BannerFile.UploadedFiles[0].SaveAs(MapPath("~/files/") + rauView0BannerFile.UploadedFiles[0].FileName, true);
}
catch(System.IO.FileNotFoundException ex)
{
   lblError.Text = "The temporary file has already been deleted";
}


Regards,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stein
Top achievements
Rank 1
answered on 29 Sep 2014, 02:24 PM
Genady: It seems that the uploaded file is deleted when using validFile.SaveAs (and the overwrite-flag to true), when refreshing the page (which causes the upload-function to trigger without having the tempfiles anymore).
0
Genady Sergeev
Telerik team
answered on 02 Oct 2014, 03:15 PM
Hi Stein,

Indeed this is true. The SaveAs operation will always clear the temp file. If you want to protect against browser refresh we suggest to use the approach showcased in my previous reply.

Regards,
Genady Sergeev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
AsyncUpload
Asked by
mastermehdi
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
mastermehdi
Top achievements
Rank 2
Stein
Top achievements
Rank 1
Share this question
or