Save Method

Object: SoftArtisans.FileUp
Syntax: Save()
Description:

This method saves an uploaded file to the Web server's hard disk using the user's original filename. If an upload contains more than one file, only the first one is saved.

To save multiple files in a single upload, use the method Save method of the SAFile object, instead: File.Save().

To use the Save method, you must set the Path property.

By default, an uploaded file will overwrite a file on the server with the same name. To prevent this, set OverwriteFilesto False.

Examples:

The following saves the upload on the Web server at C:\Uploads:

ASP <%
'--- Instantiate FileUp
Set fileUpload = Server.CreateObject("SoftArtisans.FileUp")

'--- Cache upload at C:\Uploads
fileUpload.Path = "C:\Uploads"

'--- Save upload at C:\Uploads
fileUpload.Save
%>
C# //--- Instantiate FileUp
FileUp fileUpload = new FileUp(Context);

//--- Set default Save location to C:\Uploads
//--- (Cache location is set in registry since HttpModule is used
//--- with .NET)
fileUpload.Path = "C:\\Uploads";

//--- Save upload to C:\Uploads
fileUpload.Save();
VB.NET '--- Instantiate FileUp
Dim fileUpload As New FileUp(Context)

'--- Set default Save location to C:\Uploads
'--- (Cache location is set in registry since HttpModule is used
'--- with .NET)
fileUpload.Path = "C:\Uploads"

'--- Save upload to C:\Uploads
fileUpload.Save()

The following saves the upload to a network shared drive:

ASP <%
'--- Instantiate FileUp
Set fileUpload = Server.CreateObject("SoftArtisans.FileUp")

'--- Cache upload at \\FileServer\Uploads
fileUpload.Path = "\\FileServer\Uploads"

'--- Save upload to \\FileServer\Uploads
fileUpload.Save
%>
C# //--- Instantiate FileUp
FileUp fileUpload = new FileUp(Context);

//--- Set default Save location to \\FileServer\Uploads
//--- (Cache location is set in registry since HttpModule is used
//--- with .NET)
fileUpload.Path = @"\\FileServer\Uploads";

//--- Save upload to \\FileServer\Uploads
fileUpload.Save();
VB.NET '--- Instantiate FileUp
Dim fileUpload As New FileUp(Context)

'--- Set default Save location to \\FileServer\Uploads
'--- (Cache location is set in registry since HttpModule is used '--- with .NET)
fileUpload.Path = "\\FileServer\Uploads"

'--- Save upload to \\FileServer\Uploads
fileUpload.Save()

Copyright © 2010 SoftArtisans, Inc. All rights reserved.