NetVIOS Upload Component
Uses: uploades files from local computer to website over a web page on the site.
Cost: Free
Version: 1.1
Platforms: Windows NT, Windows 2000, Windows 2003 servers.
Additional Features
- Restricts uploads by file type (a remote upload procedure is not too useful if it does not contain means to restrict uploads by file types)
- Allows other form elements to be submitted with uploaded file and retrieves their values
Download as dll file
Download as zip file
Basic Properties
Input
FileUploadControl - name of the File html GUI control of type = FILE
SavePath - path on the web server in which file will be saved
MaximumSize - limit of file size that is allowed to be uploaded
OverWriteFiles - indicator to determine if file should be uploaded if a file already exists with the same name.
Output
GetFileCount - Number of files uploaded
GetFileName(i) - Name of ith file uploaded
GetFileSize(i) - Size of ith file uploaded
Methods
Upload - performs the upload and sets the output properties (above).
Sample Code
You may use a text editor to complete this example of using the upload component. This example requires two files - one that promptes the user for the local file to upload (upload.html) and a second that uses the component to perform the upload (_upload.asp). (Note that these two files may be combined but is separated for easier illustration).
First File
Create an html page with the upload GUI control (save as upload.html for example). The html page will have content as shown below:
<html><body>
<form name="uploadform" enctype="multipart/form-data" action="_upload.asp" method="post" >
<p><input TYPE="FILE" NAME="File1" SIZE="50"><br>
<input TYPE="SUBMIT" VALUE="Upload File!"> </p>
</form>
</body></html>
Second File
Create an asp page that uses the component to perform the upload (save as _upload.asp for example). The contents will be as shown below:
<%
'Initialize the component
Set myup = Server.CreateObject("NetVIOSUpload.Upload")
'Set the name of the GUI control used in acquiring the file (from the first file)
myup.FileUploadControl = "File1"
'Set the path on the web server in which file is to be saved
myup.SavePath = "E:\Sites\NetVIOS"
'Set the maximum allowable file size in bytes
myup.MaximumSize = 5000000
'Set the overwrite property
myup.OverwriteFiles = True
'Perform the upload
upresult = myup.Upload()
If (upresult = "Success") Then
'Print an optional report of files downloaded
For i = 1 To myup.GetFileCount
Response.Write "The file - " & myup.GetFileName(i) & " of size " & myup.GetFileSize(i)
Response.Write " was successfully uploaded!"
Next
End If
'Destroy the upload component instance after use
Set myup = Nothing
%>
(Note that the colors above are used for illustration purposes only)
Notes
Ensure that the specification - enctype="multipart/form-data" - is present in the description of the upload form in the html file.
Installation
Simply copy the dll file to a folder on the webserver in which you wish to install it (for example C:\NetVIOS). Ensure that the Internet user has access to execute files in this folder.
- Open a command prompt or Click on the Window Start button then run
- Type in the command to initialize the dll - regsvr32 Path\NetVIOSUpload.dll
Path is the location in which you copied the file (for example regsvr32 C:\NetVIOS\NetVIOSUpload.dll)
To uninstall the dll - type in the command - regsvr32 Path\NetVIOSUpload.dll /unregserver
Advanced Properties
SetFileName(i) - changes the filename of the uploaded file to the value of this property (input property). i is the index of the uploaded files starting from 1. If SetFileName is not used, the file is given its original name when uploaded,
Example
To set (or force) the name of the first uploaded file to text.html use:
myup.SetFileName(1) = "text.html"
PostedData - retrieves the exact posted data
FileType - allows upload of a specific file types. The file types may be entered as a list of extensions separated by commas. Also accepts groups of file types. Accepted group types include:
- Image - .gif, .jpg, .jpeg, .bmp, .png, .wmf
- Media - .avi, .mov, .mpg, .wav, .au, .wme, .wmx, .wma, .wmv
- Text - .txt, .text
- Html - .htm, .html
- Excel - .xls, .csv
- Doc - .doc, .rtf
- Pdf - .pdf
- Alltypes - all the above types (default value)
- Anytype - allows upload of any file (user beware)
Example
If the code lines below are inserted before the Upload method is called in the first example above, only files with the extensions indicated above will be uploaded.
<%
'Allows only image files to be uploaded
myup.FileType = "Image"
'Allows only files with extension .gif and .txt to be uploaded
myup.FileType = "gif,txt"
%>
Notes
Property is not case sensitive.
If ommitted, the default is to allow the uploading of all file types!
ControlName(i) - name of an additional control or form item submitted with the form data (input property). Only 10 additional form items allowd in the current version. i is the index of the additional controls starting from 1.
ControlValue(i) - value of the submitted form data (output property). This property can only be retrieved after the Upload method has been called. i is the index of the additional controls starting from 1.
Examples
View examples of usage here http://webfacesite.netvios.com/. In each example, there is an active file (.asp), and a view file (.htm) that shows the script contents of the active file.
Source
The source for this program is available to programmers for a one-time price of $40 to be freely included with their programs. It is also available free as part of the NetVIOS managed source scheme for contributing programmers. Contact NetVIOS.
Report bugs, installation problems or questions or simply leave positive feedback here.
Other Products
Other Components