UseMemory Property


 Object: SoftArtisans.FileUp
 Syntax: UseMemory
 Type: Boolean
 Read/Write: Read/Write
 Description:

If UseMemory is set to True, FileUp will store uploaded data in memory until it is saved. By default, UseMemory is set to False and FileUp will write uploaded data to temporary files before saving.

Storing an upload in memory is faster and more secure than storing on disk. However, before enabling UseMemory, consider other factors affecting the upload, such as how much memory is available on the server, how active the server is, and the size of the upload.

UseMemory and the ISAPI Filter

When you upload to an ASP page with the extension .upl, or to an ASP.NET page with the extension .uplx, FileUp's ISAPI filter will read the whole upload request and write it to temporary files before the request is processed by ASP or ASP.NET page on the server. If you set UseMemory in the .upl or .uplx page, the property will have no effect because the page is processed after the ISAPI filter writes the temp files. To set UseMemory when using the ISAPI filter, include the property in the request query string.

 See Also: UploadContents Property
Large Uploads in ASP
Large Uploads in ASP.NET
 Examples:
Setting UseMemory in an ASP Script
<% Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")
oFileUp.UseMemory = True
... %>
Setting UseMemory in the Query String

The following lines are from a client-side upload submission script. The form submitting the file to upload contains an onSubmit event that triggers the startupload function. This function adds UseMemory=True to the query string so that the ISAPI filter receives this information and does not create temporary files.

<HEAD>
...
<SCRIPT Language="JavaScript">
function startupload() {
	document.theForm.action="formresp.uplx?usememory=true";
	}
</script>
</HEAD>
<BODY>
...
<FORM onSubmit="startupload();" name="theForm" ACTION="formresp.uplx" 
ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">
...
<INPUT TYPE="FILE" NAME="myFile"><BR>
	<I>Click "Browse" to select a file to upload</I>
<INPUT TYPE="submit" NAME="SUB1" VALUE="Upload File">
</FORM>
...

Copyright © 2004 SoftArtisans, Inc. All rights reserved.