|
We create an XForm object and specify some preferences. By
default ABCUpload will throw an error if you try to overwrite a
file that already exists. This is done for safety reasons but is
not always the behavior we desire. To force ABCUpload to overwrite
any files that already exist we set the Overwrite property of the
XForm object to True.
As a shortcut we create a reference to the image field and store
it in a variable called theField. Now we can use this as shorthand
to check each of the fields. Each field is checked. If a file has
been uploaded then it is saved out. This avoids saving zero length
files in cases where no file was uploaded by the client.
Note that we preserve the original name of the file as uploaded
from the client. The FileName property of the XField object is a
URL safe version of the original client file name.
<% @Language="VBScript" %>
<%
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.Overwrite = True
Set theField = theForm.Files("image1")
If theField.FileExists Then theField.Save theField.FileName
Set theField = theForm.Files("image2")
If theField.FileExists Then theField.Save theField.FileName
%>
<html>
<body>
Images uploaded...
</body>
</html>
|