Radasyncupload Targetfolder problem

4 posts, 0 answers
  1. Praveen kumar
    Praveen kumar avatar
    11 posts
    Member since:
    Jun 2015

    Posted 25 Jun 2015 Link to this post

    Hi everybody,

    I want to store uploaded files into Different drive (suppose E:drive) and want to specify upload file in web config file. 

      <add key="Telerik.AsyncUpload.TemporaryFolder" value="D:\temp-backup"/>

    How to refer in the code block.

      protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
            {
                List<ListItem> files = new List<ListItem>();
                int counter = 1;
                var file = e.File;
                    string targetFolder = AsyncUpload1.TargetFolder;
                    string targetFileName = System.IO.Path.Combine(targetFolder,
                        file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
                    while (System.IO.File.Exists(targetFileName))
                    {
                        counter++;
                        targetFileName = System.IO.Path.Combine(targetFolder,
                            file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
         
                    }
              
                   file.SaveAs(targetFileName);

    }

    where should i specify the appsetting string? THanks in advance

  2. Dimitar
    Admin
    Dimitar avatar
    281 posts

    Posted 30 Jun 2015 Link to this post

    Hi,

    If I understand your question correctly, you are asking where you should put the key in the web.config file. It should be added to the appSettings section of the web.config:

    <appSettings>
    ...
           <add key="Telerik.AsyncUpload.TemporaryFolder" value="D:\TestFolder"/>
    ...
    </appSettings>

    Then, if you would like to access this Temporary Folder in the code behind, you may use the RadAsyncUpload TemporaryFolder property.

    If this does not answer your question, please explain it again in another way.

    Regards,
    Dimitar
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Praveen kumar
    Praveen kumar avatar
    11 posts
    Member since:
    Jun 2015

    Posted 30 Jun 2015 in reply to Dimitar Link to this post

    Thanks for responding..

    As you see in my question. Already i tried putting the upload folder details (D Drive) in web config file. which throwing an error.

  5. Dimitar
    Admin
    Dimitar avatar
    281 posts

    Posted 01 Jul 2015 Link to this post

    Hi,

    If I do not specify a TargetFolder and try to use it in the code behind, I receive an error "Access to the path is denied." on postback. If this is your error, you should specify a TargetFolder (not TemporaryFolder) before you try to use it and the issue is gone. Or maybe you wanted to specify the TargetFolder in web.config, but you have specified TemporaryFolder by accident...

    If this is not your case, it would be helpful if you provide a runnable sample page with code behind and a web.config, which can be used to replicate your issue. You may specify the error as well. And since this forum does not allow you to attach files other than images, you may use dropbox to upload your sample files and post the URL to them.

    Regards,
    Dimitar
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top