|
We create an Upload object, and if a file has been uploaded, save
it to a location. ABCUpload will automatically detect that we're
specifying the destination location using a URL and will place the
file appropriately. Here we use the WinSafeFileName 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 WinSafeFileName will contain
the name of the file converted into the format used by 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.
<%@ Import Namespace="WebSupergoo.ABCUpload5"
%>
<html>
<body>
<%
Upload theUpload = new Upload();
UploadedFile theFile = theUpload.Files["file"];
if (theFile.Exists) {
theFile.SaveSFM("write/" + theFile.WinSafeFileName);
Response.Write("File uploaded...");
}
else {
Response.Write("No file uploaded...");
}
%>
</body>
</html>
<%@ Import Namespace="WebSupergoo.ABCUpload5"
%>
<html>
<body>
<%
Dim theUpload As Upload = New Upload()
Dim theFile As UploadedFile = theUpload.Files("file")
If theFile.Exists = True Then
theFile.SaveSFM("write/" + theFile.WinSafeFileName)
Response.Write("File uploaded...")
Else
Response.Write("No file uploaded...")
End If
%>
</body>
</html>
|