File upload control
how i get the file name from dynamically generated file upload control
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
sai babu23 pointsPosted Oct 12, 2007, 2:39 AM EDT
try the following code u will get a file name
Dim Files As HttpFileCollection
Dim intCount as integer
Dim arrCount() As String
Files = Request.Files
arrCount = Files.AllKeys ' This will get names of all files into a string array.
For intCount = 0 To arrCount.GetUpperBound(0)
If arrCount(intCount).StartsWith("fuAttachment") Then 'Filter for certain file upload control id to be saved
'Save file
Files(arrCount(intCount)).SaveAs(strPath & System.IO.Path.GetFileName(FormatFileName(Files(arrCount(intCount)).FileName)))
End If
Next