SaveToMemory (Upload Control and NextFile Object)

Dundas

SaveToMemory (Upload Control and NextFile Object)

Call this method to save uploaded files to memory and populate both the Files and Form collections.

Syntax

Object.SaveToMemory()

Remarks

You MUST EITHER CALL THIS METHOD or the Save 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 one of these methods.

If files are saved to memory then calling any of the following methods will result in an exception being thrown since there will be no files saved to disk: FileCopy, FileDelete, FileMove, SetAttributes, GetAttributes and the SetOwner methods of the UploadedFile object.

Calling the SaveToMemory method will also throw an exception if the uploaded data exceeds the maximum allowable limit, as set by the MaxUploadSize property. As a result no form data will be retrieved.

Note that calling the control's SaveToMemory method populates the Files and Form collections with one method call, while calling the SaveToMemory method of a NextFile object populates the Form and Files collections incrementally.

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