I'm using the silverlight RadUpload control. I have no problems uploading files UNTIL I try to change the name of the uploaded file.
My upload scenario has these 2 requirements:
- Save the file outside of the web site directory structure
- Ignore the actual filename and save the uploaded file with a new GUID as the filename
Here is my UploadHandler:
public class BatchUpload : RadUploadHandler
{
public override string GetTargetFolder()
{
string targetFolder = ConfigurationManager.AppSettings["BatchDataDirectory"];
return targetFolder;
}
public override string GetFileName()
{
string filename = GetQueryParameter("sysFilename");
return filename;
}
}
And here is the Silverlight code:
private void RadUpload_FileUploadStarting(object sender, FileUploadStartingEventArgs e)
{
e.FileParameters["sysFilename"] = (_sysFilename = Guid.NewGuid().ToString());
}
During the upload I can see the file in Windows Explorer and watch the file size increase, but when the upload completes, the file is empty and has a size of zero bytes
.