AsyncUpload and the TargetPhysicalFolder

7 posts, 1 answers
  1. samuel
    samuel avatar
    12 posts
    Member since:
    Sep 2008

    Posted 19 Apr 2010 Link to this post

    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
  2. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 19 Apr 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. samuel
    samuel avatar
    12 posts
    Member since:
    Sep 2008

    Posted 20 Apr 2010 Link to this post

    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
    
  5. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Apr 2010 Link to this post

    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.
  6. samuel
    samuel avatar
    12 posts
    Member since:
    Sep 2008

    Posted 23 Apr 2010 Link to this post

    Thanks Genady Sergeev

    I will test your solution.


  7. Swapnil
    Swapnil avatar
    1 posts
    Member since:
    Dec 2013

    Posted 06 Dec 2013 Link to this post

    How to Store image on server side machine using TargetFolder Property in Silverlight
  8. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 11 Dec 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017