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

Could not find file on FileUploaded

5 Answers 370 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Avery
Top achievements
Rank 1
Avery asked on 12 Dec 2010, 02:30 AM
Hello.  I have the following set of code which to me seems like it should work but I am unable to saveas the file on FileUploaded. I get the error message: Sys.WebForms.PageRequestManagerServerErrorException: Could not find file 'C:\directory path where temp files should be\rje044e5.4bx'

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Thumbnail" />
                <telerik:AjaxUpdatedControl ControlID="lblMessage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
    function fileUploaded(sender, args) {
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();
        $telerik.$(".invalid").html("");
        sender.deleteFileInputAt(0);
    }
    function validationFailed(sender, args) {
        $telerik.$(".invalid")
            .html("Invalid extension, please choose an image file");
        sender.deleteFileInputAt(0);
    }
</script>
</telerik:RadCodeBlock>
<div class="upload-panel">
    <telerik:RadBinaryImage runat="server" Width="200px" Height="150px" ResizeMode="Fit"
        ID="Thumbnail" ImageUrl="blank.png" AlternateText="Thumbnail" CssClass="binary-image" />
    <span class="invalid"></span>
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" MaxFileInputsCount="1" OnClientFileUploaded="fileUploaded"
        OnFileUploaded="AsyncUpload1_FileUploaded" 
        AllowedFileExtensions="jpeg,jpg,gif,png" 
        OnClientValidationFailed="validationFailed" MaxFileSize="819200" 
        TemporaryFolder="">
        <Localization Select="Choose Avatar" />
    </telerik:RadAsyncUpload>
</div>

Protected Sub AsyncUpload1_FileUploaded(ByVal sender As Object, ByVal e As Telerik.Web.UI.FileUploadedEventArgs) Handles AsyncUpload1.FileUploaded
    e.File.SaveAs(BasePath & UserID & e.File.GetExtension())
End Sub


For the life of me I can't figure out what I'm doing wrong here.  Any help?  Thank you very much!

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 13 Dec 2010, 03:10 PM
Hello Avery,

We had similar issue in one of the previous versions of the controls, it's described here - could you please check whether this solves the problem? Let us know the result.

Regards,
Yana
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
Avery
Top achievements
Rank 1
answered on 14 Dec 2010, 05:15 AM
Hi Yana.  That did not solve my problem.  Same error. I am using RadControls Version: v.2010.3.1109.40.
0
Yana
Telerik team
answered on 14 Dec 2010, 09:51 AM
Hello Avery,

Could you please try to isolate this issue in a simpler page and send it to us? You should open a support ticket and attach it there.

All the best,
Yana
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
Larry
Top achievements
Rank 1
answered on 03 May 2011, 07:15 PM
I also have this problem, sporadically. All my test files are tiny PNGs.

Version: 2010.3.1317.35

I have two buttons, Save and Send, that need to process the uploaded files:

 

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

var $ = $telerik.$;

 

 

 

var uploadsInProgress = 0;

 

 

 

function onFileSelected(sender, args) {

 

 

 

if (!uploadsInProgress) {

 

 

$(

"#btnSend").attr("disabled", "disabled");

 

 

$(

"#btnSave").attr("disabled", "disabled");

 

 

}

 

uploadsInProgress++;

 

}

 

 

function onFileUploaded(sender, args) {

 

 

decrementUploadsInProgress();

 

}

 

 

function onUploadFailed(sender, args) {

 

 

decrementUploadsInProgress();

 

}

 

 

function decrementUploadsInProgress() {

 

 

uploadsInProgress--;

 

 

if (!uploadsInProgress){

 

 

$(

"#btnSend").removeAttr("disabled");

 

 

$(

"#btnSave").removeAttr("disabled");

 

 

}

 

}

 

 

 

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>

 

 

 

<input type="hidden" id="UploadedFilesJson" runat="server" />

 

 

 

 

 

<telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Skin="Office2007" OnClientFileUploadFailed="onUploadFailed"

 

 

ReadOnlyFileInputs="true" OnClientFileSelected="onFileSelected" OnClientFileUploaded="onFileUploaded">

 

 

 

</telerik:RadAsyncUpload>

 


In either btn routine, I call this subroutine:

 

Private Sub Upload_GetFiles()

 

 

 

Try ' For Telerik code, http://demos.telerik.com/aspnet-ajax/upload/examples/async/webmail/defaultvb.aspx?product=asyncupload

 

 

   
    For
Each file As UploadedFile In AsyncUpload1.UploadedFiles

 

 

 

        Dim uploadedFileInfo As New UploadedFileInfo(file)

 

 

        Session(

"Dropbox_AttachmentCount") += 1 ' One more file came in

 

 

        Dim sFileName As String = Session.SessionID.ToString & "_" & Session("Dropbox_AttachmentCount").ToString '  Temp Name
        sFileName &= uploadedFileInfo.FileName.Substring(uploadedFileInfo.FileName.LastIndexOf("."), 4) ' Add the suffix
        file.SaveAs(Path.Combine(Server.MapPath("~/attachments/temp"), sFileName))

 

 

 

    Next

 

 

Catch ex As Exception

 

 

    SecureDropBox.ShowError(

Me.Page, ex.Message)

 

 

 

End Try

 

 


End
Sub

 


The "file.SaveAs" is where I get an exception, sometimes. I haven't isolated the frequency/symptoms yet but it seems like about every fourth or fifth time that I do a SAVE btn click. Every attempt has one, two or three small PNG files. Running on my desktop in development (VS2008) so timing should not be an issue.

I can submit a support ticket with my entire solution, if that helps.

Thanks in advance.
0
Genady Sergeev
Telerik team
answered on 06 May 2011, 09:52 AM
Hi Martin,

The fix has already been fixed in a later version. Is it possible to upgrade?

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.

Tags
AsyncUpload
Asked by
Avery
Top achievements
Rank 1
Answers by
Yana
Telerik team
Avery
Top achievements
Rank 1
Larry
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or