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

couldn't find the temp file (got removed just before saving)

7 Answers 104 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 28 Oct 2013, 04:10 PM
Hi expert,

I have this exception when excuting this code:

 

If AsyncUpload1.UploadedFiles.Count > 0 Then

AsyncUpload1.UploadedFiles(0).SaveAs(Server.MapPath(

 

"/documents") & fileName, True)

 

End If


then exception occurs:

Could not find file 'xxx\App_Data\RadUploadTemp\mq1ukeso.2dm'.

During debugging, I noticed that temp file 'mq1ukeso.2dm' is existed just before excuting 'SaveAs' method, and it disappear when excuting 'SaveAs...' method, is there any obvious mistake I made? many thanks for your help! 



my aspx page:

<telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"
                                                                        OnClientFileUploaded="OnClientFileUploaded"
                                                                        MaxFileSize="2097152" MaxFileInputsCount="1"
                                                                        AutoAddFileInputs="false" />

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 29 Oct 2013, 07:24 AM
Hi Ray,

There can be two possibilities behind such an error associated with the temp file.

1) You may be using an older version of Telerik RadControls which has such a known issue. You can upgrade to the latest version in which this issue is fixed.

2) When a file is uploaded by the RadAsyncUpload control it is placed in a temporary folder. After a certain time (by default 4 hours) the files from the temporary folder are deleted by the asp.net framework. If the TemporaryFileExpiration property is set, the expiration time will be different and it is possible the files to be deleted before your logic after the postback is applied and that should be causing the sporadic throwing of exceptions.

Hope this helps,
Shinu.
0
Ray
Top achievements
Rank 1
answered on 29 Oct 2013, 03:08 PM
hmm, still not working, my telerik.web.ui.dll version is 2013.2.611.40,  and my code again (this time I specified the expire time to 5 hours):

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function OnClientFilesUploaded(sender, args) {
                $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest();
                ValidatorValidate(CustomValidator);
                 
            }
 
            function OnClientFileUploaded(sender, args) {
                document.getElementById('divReplace').style.display = 'block';
            }
 
            function validateUpload(sender, args) {
                var upload = $find("RadAsyncUpload1");
                args.IsValid = upload.getUploadedFiles().length != 0;
            }
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                     
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

<telerik:RadAsyncUpload ID="AsyncUpload1" runat="server" 
                                                                        OnClientFileUploaded="OnClientFileUploaded" 
                                                                        TemporaryFileExpiration="05:00:00"
                                                                        MaxFileSize="2097152" MaxFileInputsCount="1" 
                                                                        AutoAddFileInputs="false" />

the strange part is that I can see the temp file as long as I didn't execute method 'SaveAs...', and it seems like it got removed JUST right before 'SaveAs' method run... so I don't think it's anything to do with the value of  TemporaryFileExpiration?

0
Accepted
Shinu
Top achievements
Rank 1
answered on 31 Oct 2013, 04:00 AM
Hi Ray,

You can check this sample solution I have prepared based on your code with the same RadControls version which works fine at my end. Please get back to us if it doesn't help.

Thanks,
Shinu
0
Ray
Top achievements
Rank 1
answered on 12 Nov 2013, 08:33 AM
Thanks, your code works and I think my old code was not right so what I did is I merged my code with yours, thanks!
0
Bálint
Top achievements
Rank 1
answered on 04 Oct 2014, 04:05 PM
Dear Shinu, I have the exactly same problem. I have tried to download the sample solution but already not reachable.
Do you create an another link for me?

Thanks
0
Hristo Valyavicharski
Telerik team
answered on 08 Oct 2014, 02:21 PM
Hi Bálint,

It looks like that the sample's link is inactive. What are you trying do? The temporary file should be accessible in the OnFileUploaded event.

Regards,
Hristo Valyavicharski
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.

 
0
Bálint
Top achievements
Rank 1
answered on 13 Oct 2014, 11:00 AM
Hi Hristo!

Thank you, but meanwhile I managed to resolve my problem with this control.
So everything is fine now.
Thanks!

Tags
AsyncUpload
Asked by
Ray
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Ray
Top achievements
Rank 1
Bálint
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or