|
-
Nov 27th, 2003, 11:40 AM
#1
Thread Starter
Fanatic Member
Trouble Uploading
I use the following code to handle an uploaded file :
If Not IsNothing(MyFile.PostedFile) Then
Dim filepath1 As String = Path.Combine(Path.GetTempPath), "mycvstuff.txt")
Dim strfilename As String = MyFile.PostedFile.FileName
c = System.IO.Path.GetFileName(strfilename)
Try
MyFile.PostedFile.SaveAs("C:\Documents and Settings\All Users\cvdocs\" & c)
Catch Exc As Exception
Me.Label1.Text = Exc.ToString
End Try
End If
The problem is that even when the user has not uploaded a file the code executes producing an error.
If Not IsNothing(MyFile.PostedFile) doesnt seem to work.
Any Ideas what I'm doing wrong. When I choose a file to upload it works fine.
TIA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|