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

Radasyncupload Targetfolder problem

3 Answers 168 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Praveen kumar
Top achievements
Rank 1
Praveen kumar asked on 25 Jun 2015, 04:52 PM

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

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Jun 2015, 08:18 AM
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
0
Praveen kumar
Top achievements
Rank 1
answered on 30 Jun 2015, 04:26 PM

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.

0
Dimitar
Telerik team
answered on 01 Jul 2015, 08:37 AM
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
Tags
AsyncUpload
Asked by
Praveen kumar
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Praveen kumar
Top achievements
Rank 1
Share this question
or