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

AsyncUpload and the TargetPhysicalFolder

6 Answers 377 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
samuel
Top achievements
Rank 1
samuel asked on 19 Apr 2010, 11:04 AM

Hello,

I have a problem with the TargetPhysicalFolder property on the AsyncUpload.
I use 2 websites, one for a commercial site and one for the administration.
When I use the administration site I would send in the folder of commercial site a Picture file in a folder but the AsyncUpload don't send a file in the folder. While  if I use a RadUpload then the file uploads correctly.
I want to know how to use AsynUpload with TargetPhysicalFolder.
 
I use VS 2008, Framework 3.5  and Telerik Version 2010.1.415.35

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="BackOffice.test" %> 
<%@ register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %> 
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
</head> 
<body> 
    <form runat="server" id="mainForm" method="post">  
     <telerik:RadScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" /> 
        <div> 
            <table> 
                <tr> 
                    <td id="Td1">  
                        <telerik:RadUpload ID="RadUpload2" runat="server" runat="server" MaxFileInputsCount="1" 
                            TargetPhysicalFolder="C:\\Projet En cours\\SiteCommercialPubert\\SiteCommercialPubert\\Images\\Machine\\" > 
                        </telerik:RadUpload> 
                    </td> 
                    <td id="controlContainer">  
                        <telerik:RadAsyncUpload ID="RadUpload1" runat="server" MaxFileInputsCount="1" 
                            TargetPhysicalFolder="C:\\Projet En cours\\SiteCommercialPubert\\SiteCommercialPubert\\Images\\Machine\\" > 
                        </telerik:RadAsyncUpload > 
                        <asp:Button id="buttonSubmit" runat="server" 
                            OnClick="buttonSubmit_Click" text="Submit"/>  
                    </td> 
                </tr> 
        </table> 
        </div> 
    </form> 
</body> 
</html> 



Thanks,
Xavier THIERRY

6 Answers, 1 is accepted

Sort by
0
Dimitar Milushev
Telerik team
answered on 19 Apr 2010, 12:40 PM
Hi Samuel,

When using RadAsyncUpload, you should use the TargetFolder property - it works both with relative and absolute paths.

Regards,
Dimitar Milushev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
samuel
Top achievements
Rank 1
answered on 20 Apr 2010, 09:09 AM
Hi Dimitar Milushev ,

I use 2 differents paths. I use for exemple C:\MarketSite\ and C:\AdminSite\. I would send in C:\MarketSite\Images\ a picture selected in my Admin Site and if I use C:\MarketSite\Image in the TargetFolder I have a Error 'System.Web.HttpException: 'C:\MarketSite\Images\'  is not a valid virtual path'.
[HttpException (0x80004005): 'C:\MarketSite\Images\'  is not a valid virtual path.]
   System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +8862571
   System.Web.HttpServerUtility.MapPath(String path) +90
   Telerik.Web.UI.RadAsyncUpload.RaisePostDataChangedEvent() +337
   Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +31
   System.Web.UI.Page.RaiseChangedEvents() +165
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485
0
Accepted
Genady Sergeev
Telerik team
answered on 23 Apr 2010, 09:43 AM
Hello samuel,

This seems to be a bug in RadAsyncUpload. We will try to get it fixed for the next week's latest  internal build. More information on how to obtain the latest internal build can be found here.

Meanwhile you can use the following workaround:

1) Add event handler for the FileUploaded event
2) Once there, manually save the uploaded file to the target physical folder.

You can find example how to do it below:

<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1"
        onfileuploaded="RadAsyncUpload1_FileUploaded"></telerik:RadAsyncUpload>
     
    <asp:Button runat="server" ID="Button1" Text="Postback" />

protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
    {
        var targetFolder = @"C:\temp";
        e.File.SaveAs(Path.Combine(targetFolder, e.File.GetName()));
    }

In addition, I have updated your telerik points for pointing us to this issue.

Sincerely yours,
Genady Sergeev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
samuel
Top achievements
Rank 1
answered on 23 Apr 2010, 10:53 AM
Thanks Genady Sergeev

I will test your solution.


0
Swapnil
Top achievements
Rank 1
answered on 06 Dec 2013, 10:47 AM
How to Store image on server side machine using TargetFolder Property in Silverlight
0
Hristo Valyavicharski
Telerik team
answered on 11 Dec 2013, 11:21 AM
Hi Swapnil,

There is no difference in setting the TargetFolder property for the different upload modules including Silverlight.

Regards,
Hristo Valyavicharski
Telerik
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 the blog feed now.
Tags
AsyncUpload
Asked by
samuel
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
samuel
Top achievements
Rank 1
Genady Sergeev
Telerik team
Swapnil
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or