I'm setting the TargetFolder property in the code-behind and I've noticed that setting it in the FilesSelected event is the only way I can get it to work.
If I set it anywhere else (UploadBtn_Click, UploadStarted event) then the RadUAG_targetFolder form item in the handler always picks up the value set in the XAML.
Is there a reason for this or am I doing something wrong?
An example is:
radUploader.TargetFolder = (alreadyEncoded) ? "Videos" : "Encoding"; |
Best regards,
Ryan.
6 Answers, 1 is accepted
Yes - setting the TargetFolder in the UploadStarted event is too late because the request is already prepared.
What is your scenario? Why you need to to set the TargetFolder property in this event?
Sincerely yours,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I don't need to set it in the Upload_Started event... it just needs setting when the upload button is clicked (but before the upload actually commences).
I've tried putting it in UploadButton_Click, but this has no effect either.
Kind regards,
Ryan.
First of all - sorry for the much delayed answer!
The latest event that you can use to set the TargetFolder property is the "FilesSelected" event. After that the request is build and the new value for TargetFolder property will not be sent to the server. Do you think it will be better if we allow the setting of TargetFolder when the UploadStarted event is fired?
Kind regards,
Valentin.Stoychev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
1. I am curious as to why the target folder is being set in the client.
2. I am setting it on the server in the handler, using the following code. It does not work. Please could you advise me.
<%
@ WebHandler Language="C#" Class="RadUploadHandler" %>
using
System;
using
System.Web;
public
class RadUploadHandler: Telerik.Windows.RadUploadHandler
{
public RadUploadHandler()
{
string virtualFolder = System.Configuration.ConfigurationManager.AppSettings["FileUploadVirtualFolder"];
this.TargetPhysicalFolder = HttpContext.Current.Server.MapPath(virtualFolder);
}
}
<%
@ WebHandler Language="C#" Class="RadUploadHandler" %>
using
System;
using
System.Web;
public
class RadUploadHandler: Telerik.Windows.RadUploadHandler
{
public override string GetTargetFolder()
{
string virtualFolder = System.Configuration.ConfigurationManager.AppSettings["FileUploadVirtualFolder"];
string output = HttpContext.Current.Server.MapPath(virtualFolder);
this.TargetPhysicalFolder = output;
return output;
}
}
It does not work if you use the same code in the constructor.
Thank you for your interest in the RadUpload control.
Actually the right approach is overriding the GetTargetFolder method.
All the best,
Ivan
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.