Save (Upload Control and NextFile Object)

Dundas

Save (Upload Control and NextFile Object)

Overview | Properties | Methods

Call this method to save uploaded files to disk and populate the control's collections.

Syntax

Object.Save(Path As string)

The Save method syntax has the following parts:

Part

Description

Path

A string expression specifying the folder path to save the uploaded files in. Use either a relative or absolute pathname, depending on the setting of the UseVirtualDir property.

  Remarks

Call this method to save uploaded files to disk. If the UseUniqueNames property is set to TRUE (the default) then all files will be saved with a GUID and an "_" preceding the original filename. For example, if the name of an uploaded file is "index.txt" then the corresponding file saved to disk will be "SomeGUID_index.txt". We highly recommend that you utilize unique names for saved files.

You MUST EITHER CALL THIS METHOD, the SaveToMemory method or the GetNextFile method before attempting to use either the Form or Files collections. Not only do these methods retrieve uploaded files but they also populate the Upload control's collections. A trappable error will occur if you try to utilize these collections before calling either of these methods.

Calling a save method will throw an exception if the uploaded data exceeds the maximum allowable limit, as set by the MaxUploadSize property. As a result no files will be saved and the control's collections will not be populated.

An exception will also be thrown if the specified path does not exist.

If UseVirtualDir is set to TRUE then the specified path needs to be relative. It should start with a forward slash and be followed by a valid alias, and any sub-folders need to be separated with forward slashes. If you specify a physical pathname when UseVirtualDir is TRUE an exception will be thrown.

NOTE: If you do not want to automatically retrieve all downloaded files and form data then alternatively you can use the GetNextFile method to retrieve the form data.

See Also: UseUniqueNames | MaxUploadSize | SaveToMemory | GetNextFile | Tutorial 1: Uploading Multiple Files and Using the Form and Files Collections | Tutorial 2: Retrieving Form Data Incrementally Using the GetNextFile Method