I'm having a hard time wrapping my brain around this one! The AsyncUpload is going to be part of a form that captures other information about the document. The file will be uploaded to the server and a new record is inserted into the database. As part of this, I am also modifying the filename.
My issue is that the file is moving out of the temporary location before any of the service side code is run. It IS uploaded OK and moving to the right folder. But it is doing it immediately at the form's submit button click so I am unable to change it's filename. This then causes my script to error out because it can't find the temporary file (it is already removed).
I'm sure this is a rookie question! But please take a look at this code. Thanks!
protected void btnDocUpload_Click(object sender, EventArgs e)
{
foreach (UploadedFile file in RadAsyncUpload1.UploadedFiles)
{
//we are going to rename the file with the Catnumber + the date
string newDocName = txtCatNumber.Text + DateTime.Now.ToString("M-d-yyyy");
docBL doc = new docBL();
doc.DocumentUpload(txtCatNumber.Text, newDocName);
file.SaveAs("_SDFiles_\\" + newDocName + file.GetExtension(), true);
}
}