Radasyncupload not trasfer file, no upload.

4 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 05 Dec 2012 Link to this post

    Hi,
    i'm trying radasyncupload but when start the code, seems to proceed with the transfer but then I see the remote folder and there is no file.
    My code is:

    but I have to configure something else?
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI"
                    Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI"
                    Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI"
                    Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadNotification ID="RadNotification1" runat="server"
            Skin="Office2010Silver">
        </telerik:RadNotification>
        <div>
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                    <script type="text/javascript">
                        function startManualUpload() {
                            var upload = $find('<%=RadAsyncUpload1.ClientID%>');
                            upload.startUpload();
                        }
        </script>
            </telerik:RadCodeBlock>
            <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Culture="it-IT"
                Skin="Sunset" ManualUpload="true" TargetFolder="public/image_profile">
            </telerik:RadAsyncUpload>
           <input type="button" onclick="startManualUpload()" value="start upload" />
        </div>
        </form>
    </body>
  2. Plamen
    Admin
    Plamen avatar
    2733 posts

    Posted 10 Dec 2012 Link to this post

    Hello,

     
    Here is the default way the files are saved with RadAsyncUpload. It relies on saving temporary files to work. When posted, files are saved to the designated temp folder (App_Data/RadUploadTemp by default) with unique names. Once a postback occurs the RadAsyncUpload fires the OnFileUploaded event for each file. The target file is passed as part of the arguments to the event and can be set as either valid (default) or invalid. After the events fire, all files marked as valid are automatically saved to the TargetFolder if it’s set(as it is explained here).

    Hope this will explain the issue.

    Greetings,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 12 Dec 2012 Link to this post

    I've a problem with targetfolder with radasyncupload and with the event FileUploaded.

    go to step:

    1) I set the TargetFolder init event object in code behind this is my code:

    Protected Sub RadAsyncUpload1_Init(sender As Object, e As System.EventArgs) Handles RadAsyncUpload1.Init
        RadAsyncUpload1.TargetFolder = "/Image/image_card/1"
    End Sub

    2) i set the temporaryfolder so the radasyncupload's code is:

    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Skin="Sunset"
        UploadedFilesRendering="BelowFileInput" Width="343px"
        TemporaryFolder="~/image"
        onclientfileuploaded="RadAsyncUpload1_FileUploaded">
        <Localization Select="Search" />
    </telerik:RadAsyncUpload>

    Protected Sub RadAsyncUpload1_FileUploaded(sender As Object, e As Telerik.Web.UI.FileUploadedEventArgs) Handles RadAsyncUpload1.FileUploaded
        If RadAsyncUpload1.UploadedFiles.Count > 0 Then
            Label1.Text = "File trasfered: " & RadUpload1.UploadedFiles.Item(0).FileName & "(" & RadUpload1.UploadedFiles.Item(0).ContentLength & " " & "bytes)"
            Response.Redirect("ConfermaImgCard.aspx?img=" & RadUpload1.UploadedFiles.Item(0).FileName)
        End If
    End Sub

    with this code, when you open the page of the upload, radasyncupload the object is not visible, if I delete the code: onclientfileuploaded = "RadAsyncUpload1_FileUploaded", the object is seen but the file transfer takes place only in the temporary folder and does not end in TargetFolder. Why? how do I do a postback to transfer the file from the temporary folder to the real one? Or how do I start the event FileUploaded?

    thanks








  5. Plamen
    Admin
    Plamen avatar
    2733 posts

    Posted 17 Dec 2012 Link to this post

    Hi Fabio,

     
    One way to achieve it is by triggering an AjaxRequest as it is done in this on-line demo or just by using the _doPostBack javascript function in the OnClientFileUploaded event.

    Hope this will be helpful.

    Regards,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top