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

8 posts, 1 answers
  1. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 28 Oct 2013 Link to this post

    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" />
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 29 Oct 2013 Link to this post

    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?

  5. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Oct 2013 Link to this post

    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
  6. Ray
    Ray avatar
    8 posts
    Member since:
    Mar 2012

    Posted 12 Nov 2013 Link to this post

    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!
  7. Bálint
    Bálint avatar
    2 posts
    Member since:
    Jul 2012

    Posted 04 Oct 2014 Link to this post

    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
  8. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 08 Oct 2014 Link to this post

    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.

     
  9. Bálint
    Bálint avatar
    2 posts
    Member since:
    Jul 2012

    Posted 13 Oct 2014 in reply to Hristo Valyavicharski Link to this post

    Hi Hristo!

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

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