This example shows how to combine the form and form processing pages into one.



This page contains both the upload form and the form upload processing routines. The first time the page is visited no file will be saved because no data has been posted - hence the item count is zero. When the submit button is pressed the page will post the contents to itself and this time a file will be saved.

<% @Language="VBScript" %>
Set theForm = Server.CreateObject("ABCUpload4.XForm")
If theForm.Count > 0 Then
  theForm.Overwrite = True
  Set theField = theForm.Files("filefield")
  If theField.FileExists Then
    theField.Save "myupload.dat"
  End If
End If
<form method="post" action="selfref.asp" enctype="multipart/form-data">
<input type="file" name="filefield"><br>
<input type="submit" name="submit" value="submit">