If you feel some confusion about any thing or if you do not find what you are looking for, please inform us so that we can improve our documentation accordingly. docs@aspfusion.net

AdvFile 

The component provides you complete file management on server. While turning on the component for a new website, the system takes physical path, which is usually the web root of that website. All file management operations are restricted to the physical path mentioned in ASPFusion administration. The component is very easy to use and it uses very low memory to upload a large file. The maximum size of file that can be uploaded through this is space available at target server. There is no restriction of size of the file to be uploaded. It provides following operations for server side file management.

  1. Complete basic file management operations, such as Append, Copy, Delete, Move, Read, Rename and Write a file.

  2. Along with these basic operations, it provides Upload and UploadAs facility. Upload operation allows uploading single or multiple files at a time form client browser to the server. It also allows resolving the problem of name conflicting through the property NameConflict, its values are Error (default), Skip, OverWrite and MakeUnique. UploadAs operation allows uploading single or multiple files at a time form client browser to the server with specified name. Only few lines of code is all to provide browser based File Upload on your server.

  3. It also provides Download and DownloadAs. Download operation allows downloading file to client browser with actual file name and DownloadAs operation allows downloading file to client browser with specified name.

<%set Obj = Server.CreateObject("AdvFile.File")%> 

AdvFile Properties 

Property

Description

AddNewLine

If this property is set to TRUE, a new line character is appended to the text that is written to the file. If this attribute is set to FALSE, no new line character is appended to the text. Valid values are
TRUE (default)
FALSE
Example:
<%Obj.AddNewLine = false%>

Attributes

A comma-delimited list of file attributes to be set on the file being processed. Valid values are
Normal (default)
ReadOnly
Temporary
Archive
Hidden

System
Example:
<%Obj.Attributes = “ReadOnly, Hidden”%>

Count

Return number of files to be uploaded
Example:
<%Response.Write Obj.Count”%>

DeleteFile

If this property is TRUE then file is deleted from server after downloading. Valid values are
FALSE (default)
TRUE
Example:

<%Obj.DeleteFile
= true%>

DownloadForceFully

If this property is TRUE then file is downloaded forcefully. Valid values are
FALSE (default)
TRUE
Example:

<%Obj.DownloadForceFully
= true%>

ErrorReason

Reports any errors that occur during the request
Example:
<%if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error
end if %>

Form

Return form fields values
Example:
<%Response.Write Obj.Form(“Submit”)%>

IsDefined

Check whether a form field exists or not. Return 1 if it exist otherwise 0
Example:
<%if Obj.IsDefined(“Submit”)  then
         Defined
else
         Not Defined 
end if%>

IsError

Returns 1 if any error occur during the request otherwise 0
Example:
<%if Obj.IsError = 1 then
        Error
else
        No Error
end if %>

NameConflict

Determines how the file should be handled if its name conflicts with the name of a file that already exists in the directory. Valid values are
Error (default)
Skip

MakeUnique
OverWrite
Example:
<%Obj.NameConflict = "MakeUnique"%>

SetMaxFileSize

Specified the maximum allowed size of the file to be uploaded in bytes
Example:

<%Obj.SetMaxFileSize
= 100000%>

Truncate

If this property is set to TRUE and size of the file being uploaded exceed the maximum file size, then file is truncated to maximum file size mentioned. If it is FALSE then file is not uploaded if file size exceed the limit. Valid values are
FALSE (default)
TRUE
Example:
<%Obj.Truncate = true%>

Type

This property is used to set content type for the file to be downloaded. Default value is application/octet-stream.
Example:

<%Obj.Type
= ”application/zip”%>

AdvFile Methods 

Method

Parameter

Return Value

Description

Append

Source
Data

None

Append the source file with data given
Example:
<%Obj.Append Source, Data%>

Copy

Source
Destination

None

Copy the given source file to destination
Example:
<%Obj.Copy Source, Destination%>

Delete

Source

None

Delete the given source file 
Example:
<%Obj.Delete(Source)%>

Download

Source

None

Download the source file to client’s browser
Example:
<%Obj.Download(Source)%>

DownloadAs

Source
FileName

None

Download the source file with given name to client’s browser
Example:
<%Obj.DownloadAs Source, FileName%>

Move

Source Destination

None

Move the given source file to destination
Example:
<%Obj.Move Source, Destination%>

Read

Source

Object

Read the given source file
Example:
<%set Result = Obj.Read(Source)
Response.Write Result.FileContent
set Result = nothing%>

Rename

Source Destination

None

Rename the given source file to destination
Example:
<%Obj.Rename Source, Destination%>

Upload

SaveTo

Array of objects

Upload all files to the given path
Example:
<%set Upload = Obj.Upload(SaveTo)
for each Member in Upload
      =Member.ClientFileName
      =Member.ClientFileExtension
      =Member.ServerFileName
      =Member.ServerFileExtension
      =Member.ContentType
      =Member.FileField
      =Member.CreationTime
      =Member.LastModifiedTime
      =Member.FilePath
      =Member.FileSize
next
set
Upload = nothing%>

UploadAs

SaveTo

Array of objects

Upload files to the given path with given filename
Example:
<%set Upload = Obj.UploadAs(SaveTo)

for each Member in Upload
      if (Member.FileField = "File1") then
          Member.NameConflict = "
OverWrite"
          Member.SaveAs(Name.extension)
          if (Member.IsError = 1) then
              Member.ErrorReason
          else
              =Member.ClientFileName
              =Member.ClientFileExtension
              =Member.ServerFileName
              =Member.ServerFileExtension
              =Member.ContentType
              =Member.FileField
              =Member.CreationTime
              =Member.LastModifiedTime
              =Member.FilePath
              =Member.FileSize
          end if
      end if
next
set Upload = nothing%>

Write

Source
Data

None

Write the source file with data given
Example:
<%Obj.Write Source, Data%>

Back

Copyright © 2000, Advanced Communications