I am using RadAsyncUpload and cannot get it to work with more than one file.
Basically, I'm using the FileUploaded event to save the file as a different filename (using a GUID) to ensure uniqueness.
This is what i am seeing (an example that I stepped through):
1. I upload two files on my form
2. After selecting the files and the status says they are complete, they are in the App_Data\Uploasd folder as:
fvcjn4uc.ls0
RadUploadTestFile
skhgx0p0.0at
3. I post the page
4. I step through and let it go through the first file, and it works, and I see that fvcjn4uc.ls0 is removed from App_Data\Uploads (e.g. only skhgx0p0.0at and RadUploadTestFile remains).
5. I then go through the next item in the foreach loop and it can access the filename and extension fine but when it does e.File.SaveAs(newFilename) I get (full path removed w/"HIDDEN"):
Could not find file 'C:\TFS\2010\[HIDDEN]\App_Data\Uploads\fvcjn4uc.ls0'.
But that's the filename of the FIRST file that was removed, why is it trying to access this again?
Code:
protected void RadAsyncUploadAttachments_FileUploaded(object sender, FileUploadedEventArgs e)
{
try
{
foreach (UploadedFile newfile in RadAsyncUploadAttachments.UploadedFiles)
{
if (newfile != null)
{
string originalFilename = newfile.FileName;
string filename = Guid.NewGuid().ToString() + newfile.GetExtension();
string newFilename = RadAsyncUploadAttachments.TargetFolder + @"\" + filename;
e.File.SaveAs(newFilename);
}
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
What am I missing?
Thanks,
Dave
Basically, I'm using the FileUploaded event to save the file as a different filename (using a GUID) to ensure uniqueness.
This is what i am seeing (an example that I stepped through):
1. I upload two files on my form
2. After selecting the files and the status says they are complete, they are in the App_Data\Uploasd folder as:
fvcjn4uc.ls0
RadUploadTestFile
skhgx0p0.0at
3. I post the page
4. I step through and let it go through the first file, and it works, and I see that fvcjn4uc.ls0 is removed from App_Data\Uploads (e.g. only skhgx0p0.0at and RadUploadTestFile remains).
5. I then go through the next item in the foreach loop and it can access the filename and extension fine but when it does e.File.SaveAs(newFilename) I get (full path removed w/"HIDDEN"):
Could not find file 'C:\TFS\2010\[HIDDEN]\App_Data\Uploads\fvcjn4uc.ls0'.
But that's the filename of the FIRST file that was removed, why is it trying to access this again?
Code:
protected void RadAsyncUploadAttachments_FileUploaded(object sender, FileUploadedEventArgs e)
{
try
{
foreach (UploadedFile newfile in RadAsyncUploadAttachments.UploadedFiles)
{
if (newfile != null)
{
string originalFilename = newfile.FileName;
string filename = Guid.NewGuid().ToString() + newfile.GetExtension();
string newFilename = RadAsyncUploadAttachments.TargetFolder + @"\" + filename;
e.File.SaveAs(newFilename);
}
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
What am I missing?
Thanks,
Dave