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

Radasyncupload not trasfer file, no upload.

3 Answers 250 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 05 Dec 2012, 06:55 PM
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>

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Dec 2012, 12:25 PM
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.
0
Fabio Cirillo
Top achievements
Rank 1
answered on 12 Dec 2012, 05:41 PM
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








0
Plamen
Telerik team
answered on 17 Dec 2012, 11:06 AM
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.
Tags
AsyncUpload
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Fabio Cirillo
Top achievements
Rank 1
Share this question
or