File Uploads using SA Fileup

For download and infomation consult the soft artisans web site. Click here
or this article

<form action="http://www.geocities.com/paulrowland2000/Dev/testUpload.asp" method="POST" enctype="multipart/form-data" ID=Form1> <input size="46" name="fileUP" type="file" title="click to browse" ID=File1> <br><input type="submit" value="Click to upload"> </form ---------------- Processing Form ---------------- Set oUp = Server.CreateObject("SoftArtisans.FileUp") strPath = server.MapPath("/") If oUp.IsEmpty Then %>The file that you uploaded was empty. Most likely, you did not specify a valid filename to your browser or you left the filename field blank. Please try again.<% ElseIf oUp.ContentDisposition <> "form-data" Then %>Your upload did not succeed, most likely because your browser does not support Upload via this mechanism.<% Else %><P>The file was successfully transmitted by the user.</P><% ' save file ' ========== strFilename = getOriginalFileName(oUp.form("fileUp").UserFileName) If strFilename <> "" Then Response.Write "<BR><BR>file saved to == " & strPath & "\" & strFilename oUp.form("fileUp").SaveAs (strPath & "\" & strFilename) If Err <> 0 Then %><br><b>An error occurred when saving the file on the server.</b><% Else %><br><b>File saved successfully.</b><% End If Else Response.Write "<BR> no filename " End if End if ' get other form variables hiddenVar = oUp.Form("hiddenVar") function getOriginalFilename(strUploadedFile) Response.Write "<BR>full path = " & strUploadedFile dim tempvar if strUploadedFile="" then getOriginalFilename = "" exit function end if tempvar = InStrRev(strUploadedFile,chr(92),len(strUploadedFile)) tempvar = len(strUploadedFile) - tempvar Response.Write "<BR>just file name = " & right(strUploadedFile, tempvar) getOriginalFilename = right(strUploadedFile, tempvar) end function
Hosted by www.Geocities.ws

1