This example shows how to upload a file to a file server preserving any Macintosh or Unicode attributes of the original file.



Our multipart HTML form contains one file field for upload. This page then submits data to sfmupload.asp.

<form method="post" action="sfmupload.asp" enctype="multipart/form-data">
<input type="file" name="file"><br>
<input type="submit" name="submit" value="submit">


We create an XForm object and tell it that we will be using absolute pathnames rather than virtual ones. If a file has been uploaded we save it out to an absolute path that we specify. Here we are using SafeFileName to name the file - this is a Windows safe version of the original file name in Unicode format.

If the file came from a Macintosh the SafeFileName will contain the name of the file converted into the format used by Windows NT Services For Macintosh (SFM). If the file was uploaded by Internet Explorer and is saved to a SFM volume Macintosh users will see a file identical to the original uploaded file with both resource and data forks intact.

<% @Language="VBScript" %>
Set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.AbsolutePath = True
Set theField = theForm.Files("file")
If theField.FileExists Then
  theField.Save "C:\" & theField.SafeFileName
  Response.Write "File uploaded..."
  Response.Write "No file uploaded..."
End If