Path Property

Object: SoftArtisans.SAFile
Syntax: Path[= Physical Path As String]
Type: String
Read/Write: Read/Write
Description:

This property, when used from the SAFile object defines the directory to which a file will be saved.

FileUpmust be able to write into this directory. Set permissions accordingly. For more information, please see the "Configuration and Application Planning" chapter.

It is important to distinguish between the Path property of the FileUp object and the Path property of the SAFile object. In ASP, or in ASP.NET when the HttpModule is not used, the Path property of the FileUp object is used as the location to cache the upload Request. To be used effectively, it must be set before any of the form elements are referenced. In ASP or in ASP.NET, the path property of the FileUp object is set to determine the default directory to be used for saving the files. Setting the path property of the SAFile object cannot affect caching location, but it can be used to change the default saving location on a per-file basis.

If no value is provided FileUpuses the system-defined Temporary Path (which is returned by the WIN32 GetTempPath() routine). Typically, this is "C:\Temp".

Examples:

Cache the upload on the web server at C:\Uploads and save the first uploaded file to C:\Uploads\MyFirstFile\.

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

'--- Set cache/default save location to web server path
fileUpload.Path = "C:\Uploads"

'--- Set the default save location for the first file
fileUpload.Form("File1").Path = "C:\Uploads\MyFirstFile\"

'--- Save first uploaded file
fileUpload.Form("File1").Save
%>
C# //--- Instantiate FileUp
FileUp fileUpload = new FileUp(Context);

//--- Set default save location to web server path
//--- (Cache location is set using FileUpTempDir registry key) fileUpload.Path = @"C:\Uploads";

//--- Set the default save location for the first file
((SaFile)fileUpload.Form["File1"]).Path =
@"C:\Uploads\MyFirstFile\";

//--- Save first uploaded file
((SaFile)fileUpload.Form["File1"]).Save();
VB.NET '--- Instantiate FileUp
Dim fileUpload As New FileUp(Context);

'--- Set default save location to web server path
'--- (Cache location is set using FileUpTempDir registry key) fileUpload.Path = "C:\Uploads"

'--- Set the default save location for the first file
CType(fileUpload.Form("File1"), SaFile).Path = _
"C:\Uploads\MyFirstFile\"

'--- Save first uploaded file
CType(fileUpload.Form("File1"), SaFile).Save()

Cache the upload to the web server and save the first uploaded file to a network shared drive:

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

'--- Set cache/default save location to web server path
fileUpload.Path = "C:\Temp"

'--- Set the default save location for the first file
fileUpload.Form("File1").Path = "\\FileServer\Uploads"

'--- Save first uploaded file
fileUpload.Form("File1").Save
%>
C# //--- Instantiate FileUp
FileUp fileUpload = new FileUp(Context);

//--- (Cache location is set to C:\Temp using FileUpTempDir registry
//--- key)

//--- Set the default save location for the first file
((SaFile)fileUpload.Form["File1"]).Path =
@"\\FileServer\Uploads";

//--- Save first uploaded file
((SaFile)fileUpload.Form["File1"]).Save;
VB.NET '--- Instantiate FileUp
Dim fileUpload As New FileUp(Context);

'--- (Cache location is set to C:\Temp using FileUpTempDir registry
'--- key)

'--- Set the default save location for the first file
CType(fileUpload.Form("File1"), SaFile).Path = _
"\\FileServer\Uploads"

'--- Save first uploaded file
CType(fileUpload.Form("File1"), SaFile).Save

Copyright © 2010 SoftArtisans, Inc. All rights reserved.