following code i am using to upload file
<script runat="server" language="VB">
Dim sFullPath
sub btnSubmit_click(byval sender as system.object, byval e as eventArgs)
If Len(File1.PostedFile.FileName) > 0 then
Dim sPath, sPathFriendly, sFile, sSplit
sPath = Server.MapPath(".")
If Right(sPath, 1) <> "\" Then
sPathFriendly = sPath 'Friendly path name for display
sPath = sPath & "\"
Else
sPathFriendly = Left(sPath, Len(sPath) - 1)
End If
sFile = File1.PostedFile.FileName
sSplit = Split(sFile, "\")
sFile = sSplit(UBound(sSplit))
sPath = "D:\temp\"
sFullPath = sPath & sFile
File1.PostedFile.SaveAs(sFullPath)
file_panel.visible=false
msg.text="<font color=red><b>Your file ( " & sFile & ") has been uploaded successfully.</b></font>"
end if
end sub
</script>
This code works fine when we use without query string e.g but when i use something like
it gives me syste.nullreference error
I am using multipart/form-data with all of my form
You can test page on
(upload file will work)
(upload file will not work)
any response will be appreciated
<script runat="server" language="VB">
Dim sFullPath
sub btnSubmit_click(byval sender as system.object, byval e as eventArgs)
If Len(File1.PostedFile.FileName) > 0 then
Dim sPath, sPathFriendly, sFile, sSplit
sPath = Server.MapPath(".")
If Right(sPath, 1) <> "\" Then
sPathFriendly = sPath 'Friendly path name for display
sPath = sPath & "\"
Else
sPathFriendly = Left(sPath, Len(sPath) - 1)
End If
sFile = File1.PostedFile.FileName
sSplit = Split(sFile, "\")
sFile = sSplit(UBound(sSplit))
sPath = "D:\temp\"
sFullPath = sPath & sFile
File1.PostedFile.SaveAs(sFullPath)
file_panel.visible=false
msg.text="<font color=red><b>Your file ( " & sFile & ") has been uploaded successfully.</b></font>"
end if
end sub
</script>
This code works fine when we use without query string e.g but when i use something like
it gives me syste.nullreference error
I am using multipart/form-data with all of my form
You can test page on
(upload file will work)
(upload file will not work)
any response will be appreciated