I have tried the following:
protected void AttachmentAsyncUpload_OnFileUploaded(object sender, FileUploadedEventArgs e)
{
string targetFolder = ((RadAsyncUpload)sender).TargetFolder;
Response.Write(Server.MapPath(targetFolder + "/" + e.File.FileName));
}
but this is not returning the filename on the disk - I need the full temp file name for example: 1372860982657testdoc.jpg and not just testdoc.jpg
My understanding is that the files are not cleared by default for 4 hours and I need to be able to read the file contents after several postbacks so need to know the temp filenames.
Thanks
Tony
7 Answers, 1 is accepted

Based on this forum thread, The temporary filename is not available on the client due to security reasons. The server side code you tried does not return the Temporary file name. In that code Server.MapPath(targetFolder + "/" + e.File.FileName) statement provides the final path of the uploaded file on the server.
Finally, all processed temporary files are deleted. Temporary files are also deleted after a set amount of time defined by the TemporaryFileExpiration property. If this property is not set, it will be deleted automatically by the .NET framework after 4 hours.
Thanks,
Shinu.

If I iterate the RadAsyncUpload.UploadedFiles list I can see properties of the files and would normally use the
InputStream to read the file and save but I don't want to save the file at this point - I need the temp filename.
Using the debugger I expanded non-public members and can see a property TempFilePath - this has the full path and the temporary filename I need - is there a way (without reflection) to access this property?
Thanks
Tony
Basically Temporary file directory is used only internally in RadAsyncUpload and the files in it should not be modified and that is why they can not be used from the server.
Would you please elaborate what exactly are you trying to achieve so we could be more helpful with a possible solution?
Plamen
Telerik

I'm using the asp.net wizard control and on step 3 of 4 I have a RadGrid with the AsyncUpload control as part of the grid.
When the grid row is saved the form posts back but I dont save the file - I just want to keep a reference to the temporary file name - this appears to be saved with a unique filename which I had planned to use when the wizard is complete?
Thanks
Tony
Thank you for elaborating the issue.
Unfortunately such behavior is not supported by RadAsyncUpload.
The only possible workaround is to persist the uploaded files-please have in mind that this is possible only if the control is rendered on the page.
Hope this will explain the issue.
Plamen
Telerik

foreach(UploadedFile file in rauUploadFiles.UploadedFiles)
{
FileStream tmpFile = (FileStream) file.InputStream;
images = Directory.GetFiles(HttpContext.Current.Server.MapPath("~/temp")).Where(f => f.Equals(tmpFile.Name)).ToList();
}
I hope this helps

you Dont need to worry about the temperate file name , you can download the selected file into Database (and have a special field as temp download) , if you have a wizard then you can save it permanently later on (Change the temp field indicator) , I have this full example how to use the RadAsyncUpload and save it into a database , Thanks Telerik to make it easy:
----- RadAsyncUpload
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" MultipleFileSelection="Automatic" PostbackTriggers="RadButton_Upload" RenderMode="Lightweight" ToolTip="Select to Upload Documents for this customer">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="RadButton_Upload" runat="server" SingleClick="True" Text="Upload File(s)">
</telerik:RadButton>
------ database
[FileName] [varchar](max) NULL,
[FileType] [varchar](max) NULL,
[FileSize] [varchar](50) NULL,
[FileExtension] [varchar](50) NULL,
[Added_Date] [datetime] NULL,
[Added_User] [int] NULL,
[RawDataVarbinary] [varbinary](max) NULL,
[LastModify] [datetime] NULL
-------vb.net code
Private Sub RadAsyncUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs) Handles RadAsyncUpload1.FileUploaded
Dim Get_user_ID As String = Page.User.Identity.Name
Dim fileStream As Stream = e.File.InputStream
Dim attachmentBytes As Byte() = New Byte(fileStream.Length - 1) {} 'RawData
fileStream.Read(attachmentBytes, 0, Convert.ToInt32(fileStream.Length))
Dim Myconnectionstring As String = Web.Configuration.WebConfigurationManager.ConnectionStrings("YourDatabaseString").ConnectionString
Dim MyConnection As New SqlConnection(Myconnectionstring)
Dim SQL_text As String
Dim RecordCount As Integer
Dim MyReader As SqlDataReader
SQL_text = "INSERT INTO filesTable " '
SQL_text = SQL_text & "(FileName"
SQL_text = SQL_text & ",FileType"
SQL_text = SQL_text & ",FileSize"
SQL_text = SQL_text & ",Added_Date"
SQL_text = SQL_text & ",Added_User"
SQL_text = SQL_text & ",FileExtension"
SQL_text = SQL_text & ",LastModify"
SQL_text = SQL_text & ",RawDataVarbinary)"
SQL_text = SQL_text & " Values ("
SQL_text = SQL_text & "'" & e.UploadResult.FileName.ToString & "'," ' file name
SQL_text = SQL_text & "'" & e.UploadResult.ContentType.ToString & "'," ' type
SQL_text = SQL_text & "'" & e.UploadResult.ContentLength.ToString & "'," ' size
SQL_text = SQL_text & "'" & DateTime.Now & "',"
SQL_text = SQL_text & "'" & Get_user_ID & "'," ' added by user ID
SQL_text = SQL_text & "'" & e.File.GetExtension.ToString & "'," ' File Extension
SQL_text = SQL_text & "'" & e.File.LastModifiedDate & "'," ' Last Modify date Time
SQL_text = SQL_text & "@RawData)"
Dim MySelectCm As New SqlCommand(SQL_text, MyConnection)
MySelectCm.Parameters.AddWithValue("@RawData", attachmentBytes)
MyConnection.Open()
RecordCount = MySelectCm.ExecuteScalar ' add
MyConnection.Close()
End Sub