SuperUpload Pro | Enterprise | Gold

The SuperUpload feature of ASP-db2000 is designed for the next generation of ASP-db and is available at this time as a stand alone component.




Form Syntax: 
Set aFormElementsCollection = object.Form
Set aFormElement = object.Form(name)

This property retrieves the collection of form elements. See FormElement object description for details. The collection is indexed by FormElements name (see FormElement.Name property).

FileElements Syntax:
Set aFileElementsCollection = object.FileElements
Set aFileElement = object.FileElements(name)

This property contains info on files uploaded. See FileElement object description for details. The collection is indexed by FileElements name (see FileElement.Name property).

OverwriteFiles Syntax:
object.OverwriteFiles = aBoolean
= object.OverwriteFiles

This property determines if an upload will overwrite an existing file on the server.

Default = True

Path Syntax:
object.Path = aString
= object.Path

This property defines the default directory for storing files. It also defines the location of the cache files before a final save is executed.

FileElement Object
Name Syntax:
aString = object.Name

The property contains the name of the input field in the original HTML form.

ContentDisposition Syntax:
aString = object.ContentDisposition

This property contains the MIME Content Disposition of the data. This should always be "form-data" when using a browser that supports RFC1867 uploads.

ContentType Syntax:
aString = object.ContentType

The property contains the first part of the MIME type of the file. I.e. for image file the ContentType property is “image”.

ContentSubtype Syntax:
aString = object.ContentType

The property contains the second part of the MIME type of the file. I.e. for GIF format file the ContentType property is “gif”.

ContentTransferEncoding Syntax:
aString = object.ContentTransferEncoding

This property is typically blank, but may contain the MIME Content Transfer Encoding.

ClientFileName Syntax:
aString = object.ClientFileName

This property contains the name of the file that was uploaded on the user's hard disk.

ClientFilePath Syntax:
aString = object.ClientFilePath

This property contains the path of the file that was uploaded on the user's hard disk.

Size Syntax:
aLong = object.Size

This property displays the actual numbers of bytes of the file written to disk.

FormElement Object
Name Syntax:
aString = object.Name

The property contains the name of the input field in the original HTML form.

Value Syntax:
aString = object.Value

The property contains the value of the input field.


Methods Description
DenyPath Syntax:  object.DenyPath aPath

This method allows to block file uploads to specified physical or virtual locations. This also blocks upload to nested folders. Physical paths should be specified starting with the drive letter and with backslashes, and virtual locations — starting with a slash.


DenySize Syntax: object.DenySize aLong

The method allows setting the maximum limit of total number of bytes (including both files and form elements) that can be read from the client. After the specified number of bytes has been uploaded from the client, all extra files and form elements are ignored.

By default the denied size is set to 0, which means no limits.

Upload Syntax : object.Upload

This method reads the request from client, parses it and fills in Files and Form collections. The call to this method must be issued before files and form elements can be accessed.

FileElement Object
Save Syntax:
aBoolean = object.Save
aBoolean = object.Save( aPath, aFileName)

This method saves an uploaded file to the web server's hard disk. Both aPath and aFileName are optional parameters. If aPath is not specified the file is saved to the directory defined by the previously assigned Path property (see SuperUpload object, property Path). If aFileName not specified the client’s original filename is used.

The method returns True if the file was saved successfully.

SaveToField Syntax:
aBoolean = object.SaveToField( anADOField)

This method saves an uploaded file to a database. Valid field types are 205 (BLOB) and 203 (Memo). Returns True if saved successfully

SaveInVirtualDir Syntax:
aBoolean = object.SaveInVirtualDir
aBoolean = object. SaveInVirtualDir( aVirtualDir)

This method saves an uploaded file to the web server's hard disk in a location specified by the virtual directory or filename in a virtual directory. Parameter aVirtualDir is optional. If not specified the file is saved to the same virtual location where the asp and DLL are located. Returns True if saved successfully.




<p align="left">

<FONT SIZE=6 color="green" face="Arial,Helvetica"><B><I>ASP-db SuperUp Demo<br>

<b><font face="Arial,Helvetica" size="3"><br>
Input an image file
(gif, jpeg or png) and a text file by clicking the Browse button. The content of
text file will go into the Access
database as a memo field (201, 203) and the image will be stored as a BLOB field
(128, 204, 205). The contents will then be retrieved and displayed using a few lines of standard ASP-db code.
You can easily combine this upload feature with the standard ASP-db features to
implement dynamic &quot;Content Management&quot; projects. Total upload size of
this demo is limited to 50K. Image width is set to 128 wide. HTML files upload
is prohibited. DB will be cleaned up at end of day.</font></b>

<p align="left">&nbsp;
<table cellspacing='0' cellpadding='2' rules='all' bordercolor='#000000' border='1' style='background-color: #FFFFFF; border-collapse: collapse; border-color: Black' width="100%">
<td width="50%" align="center" bgcolor="#00FF00"><b><font face="Arial,Helvetica" size="3">Methods</font></b>

<td width="50%" align="center" bgcolor="#00FF00"><b><font face="Arial,Helvetica" size="3">Properties</font></b></td>
<td width="50%" bgcolor="#00FF00"><font face="Arial,Helvetica" size="3">DenyPath; DenySize;
Upload; SavetoFile; SaveToField; SaveInVirtualDirectory;&nbsp;</font></td>
<td width="50%" bgcolor="#00FF00"><font face="Arial,Helvetica" size="3">FormName
and Value;&nbsp; FilePath; FileName; Overwrite; ContentType and Subtype;
ContentTransferEncoding; WriteSize</font></td>


<form method="post" enctype="multipart/form-data" action="SuperUpload-3.asp">
<input type="hidden" name="input_hidden" value="myhiddenvalue">
<table cellpadding="5" cellspacing="0" border="0">
<p align="right">Input your ID</td>
<td><input name="ID"></td>
<p align="right">Input Image File (jpg, gif or png)</p>
<td><input type="file" accept="*.gif" name="FileItem"></td>
<p align="right">Input Memo Text File</p>
<td><input type="file" accept="*.gif" name="FileItem"></td>
<td colspan="2">
<p align="center"><input type="submit" value="Upload to Access DB, Retrieve and and Display"></p>


dim r

set r = Server.CreateObject("SuperUpload.UploadRequest")
r.DenySize 50000
r.Path = "e:\inetpub\wwwroot\aspdb\upload\"

'response.write(myID & "<BR>")

' Open the database from the current virtual directory
dim rs, database
database = Server.MapPath("/aspdb/upload/SuperUp.mdb")
set rs = Server.CreateObject("ADODB.Recordset")

' Access connect string
dim cnn
cnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" & database & """"
rs.Open "table1", cnn, 1,3, 2 'adLockOptimistic, adCmdTable
'response.write("MYID=" & myID & "<BR>")
for each file in r.Files
if file.clientFileName <> "" then
if file.contenttype="image" then
rs("ImageFilename") = file.ClientFileName
rs("ImageContentType") = file.ContentType & "/" & file.ContentSubtype
file.SaveToField rs("OLEOBJField")
elseif file.contenttype="text" and instr(1,file.contenttype,"htm",1)=0 then
rs("MemoFilename") = file.ClientFileName
rs("MemoContentType") = file.ContentType & "/" & file.ContentSubtype
file.SaveToField rs("MemoField")
end if
end if



<B><I><font color="green" face="Arial,Helvetica" size="5">ASP-db SuperUp Demo - Retrieve Uploaded Data from Access DB</font>

<font face="Arial" size="4"><b>

Images are resized to WIDTH=128.
This demo stores the images as an OLE Object inside the Access database instead
of storing as a file and use &lt;IMG&gt; to display.</b></font>

Set X= Server.CreateObject("ASP.DB")
X.dbUnit = "999"
X.dbMode = "Dual-Horiz"
X.dbBLOB = "OLEOBJField,image/gif,Browser,0,128,"
X.dbFormHideFlds = "MemoField"
X.dbFormMemo = "10 x 50,MemoField"
X.dbGridDisplayFlds = "ID"
X.dbGridHideFlds = "MemoField"
X.dbMemoTextSize = -1
X.dbDSN = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=e:\inetpub\wwwroot\aspdb\upload\SuperUp.mdb"
X.dbSQL = "SELECT AutoNum,ID,MemoFilename,MemoContentType,ImageFilename,ImageContentType,TimeStamp,OLEOBJField,MemoField FROM Table1 order by Autonum desc"