jkruer01
08-13-2003, 05:05 PM
Hello,
I am trying to create a form where someone can upload a file to the webserver. Once I choose the file and click submit, I recieve the "Page Cannot Be Displayed Error". Can you please look at my code and tell me what is wrong? I know that the page is there because the target is the same page as the form page. Any suggestions would be appreciated.
Thanks,
<%
Option Explicit
Dim upl, NewFileName
Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
If Len(upl.Form("File1")) > 0 Then
NewFileName = "http://www.myurl.com/folder/" & upl.ExtractFileName(upl.Form("File1"))
If upl.SaveToWeb("File1", NewFileName) Then
Response.Write("File successfully written to disk.")
Else
Response.Write("There was an error saving the file to disk.")
End If
End If
%>
<form action="challenger.asp" method="post" enctype="multipart/form-data">
<table align="center">
<tr>
<td>Select File ("challenger.pdf")</td>
<td><input type="File" name="File1"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="Submit" value="Upload..."></td>
</tr>
</table>
</form>
</body>
</html>
I am trying to create a form where someone can upload a file to the webserver. Once I choose the file and click submit, I recieve the "Page Cannot Be Displayed Error". Can you please look at my code and tell me what is wrong? I know that the page is there because the target is the same page as the form page. Any suggestions would be appreciated.
Thanks,
<%
Option Explicit
Dim upl, NewFileName
Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
If Len(upl.Form("File1")) > 0 Then
NewFileName = "http://www.myurl.com/folder/" & upl.ExtractFileName(upl.Form("File1"))
If upl.SaveToWeb("File1", NewFileName) Then
Response.Write("File successfully written to disk.")
Else
Response.Write("There was an error saving the file to disk.")
End If
End If
%>
<form action="challenger.asp" method="post" enctype="multipart/form-data">
<table align="center">
<tr>
<td>Select File ("challenger.pdf")</td>
<td><input type="File" name="File1"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="Submit" value="Upload..."></td>
</tr>
</table>
</form>
</body>
</html>