NextFile Object (Dundas Upload Control 2.0)

Dundas

NextFile Object (Dundas Upload Control 2.0)

Contains header information for a file originating from a file input box.

Remarks

A NextFile object is returned from a GetNextFile call.

The NextFile object stores header information for a file resulting from a form's file input box. You can examine the exposed properties of the NextFile object and decide whether or not you want to allow the user to upload the file. To allow the upload to occur call the Save or SaveToMemory methods of the NextFile object. To cancel the upload just call the GetNextFile method again without calling either the Save or SaveToMemory method first.

To see sample source code illustrating how to loop through all files the user wants to upload to the server see the GetNextFile topic.

See Also: GetNextFile | Tutorial 2: Retrieving Form Data Incrementally Using the GetNextFile Method

Example

'this sample code will determine if an image file has been specified by the user ' to be uploaded. If it is not an image file then we will not allow the
' upload to occur. Note that we are assuming that a form has POSTED data

' to this page, using an encoding type of "Multipart/Form-Data".

'create an instance of the Upload control
Set
objUpload = Server.CreateObject("Dundas.Upload.2")

'call GetNextFile to retrieve the header for the file which the user wants
' to upload. Note that GetNextFile will return a value of "Nothing" if

' the user did not specify any files at all to be uploaded. Also note that

' GetNextFile populates the control's Form collection with the values of

' ALL form elements which occur in the html form ONLY up until the first

' encountered, populated file input box. If no populated file input box

' is found then all form element values will be inserted into the Form collection.

Set
objNextFile = objUpload.GetNextFile()

If InStr(1,objNextFile.ContentType,"image") Then
objNextFile.SaveToMemory
End If

'release resources
Set
objUpload = Nothing