Components -Asp Smart Upload
| Overview | |||||||||||||||
| ASP component to manage uploads to and downloads from your web site. |
|||||||||||||||
| Methods/Properties | |||||||||||||||
|
The TotalMaxFileSize property contains the maximum allowed size of all files to be uploaded. If this property is null then there is no limit for the total file's size uploaded. By default this property is null. If there is a key in the Registry corresponding to this property, then it keeps the string value of this key. Syntax Return Value Example
The MaxFileSize property contains the maximum allowed size of one file to be uploaded. If this property is null then there is no limit for the file's size uploaded. By default this property is null. If there is a key in the Registry corresponding to this property, then it keeps the string value of this key. Syntax Return Value Example
The AllowedFilesList property contains the list of file's extensions which are allowed to be uploaded. If this list is empty then all files are allowed. If the list is not empty then only the files with a specified extension are allowed. In order to allow the files without extension list must contain two commas ",,". By default this property is empty. If there is a key in the Registry corresponding to this property, then it keeps the string value of this key. Syntax Return Value Example
The DeniedFilesList property contains the list of file's extensions which are denied to be uploaded. If this list is empty then no files are denied. All the files with an extension in the DeniedFileslist are denied even if they are in the AllowedFilesList. In order to deny the files without an extension the list must contain two commas ",,". By default this property is empty. If there is a key in the Registry corresponding to this property, then it keeps the string value of this key. Syntax Return Value Example
The DenyPhysicalPath property prevents to access a path other that a virtual path of the Web Server. By default this property is false. If there is a key in the Registry corresponding to this property, then it keeps the string value of this key. Syntax Return Value Example
The ContentDisposition property contains the string of the Content Disposition Hearders for the MIME Type. Syntax Values Example
The DownloadBlockSize value is used to determine how much data will be read from the data source at one time. This property is used in following methods : FieldToFile, DownloadFile and DownloadField. Syntax Example
The TotalBytes property contains the Size in bytes of the POST form. Syntax Return Value Example
The BinaryData property returns the Byte corresponding to the table index containing the transmitted data. Syntax Return Value Example
The Upload method. Syntax Example
The Save method saves all files in the disk. Syntax Example
The DownloadFile method. Syntax Example
The DownloadField method. Syntax Example
The FieldToFile method writes file from a DataBase to a specified directory. This method creates a new file. Syntax Parameter Example
The UploadInFile method creates a new file with all data of the POST form. Syntax Parameter Example
| |||||||||||||||
| Example | |||||||||||||||
On Error Resume Next
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Only allow txt or htm files
' ***************************
mySmartUpload.AllowedFilesList = "htm,txt"
' DeniedFilesList can also be used :
' Allow all files except exe, bat and asp
' ***************************************
' mySmartUpload.DeniedFilesList = "exe,bat,asp"
' Deny physical path
' *******************
mySmartUpload.DenyPhysicalPath = True
' Only allow files smaller than 50000 bytes
' *****************************************
mySmartUpload.MaxFileSize = 50000
' Deny upload if the total fila size is greater than 200000 bytes
' ***************************************************************
mySmartUpload.TotalMaxFileSize = 200000
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
intCount = mySmartUpload.Save("/aspSmartUpload/Upload")
' sample with a physical path
' intCount = mySmartUpload.Save("c:\temp\")
' Trap errors
' ***********
If Err Then
Response.Write("Wrong selection : " & Err.description)
Else
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")
End If
|
