|
 |
|
|
|
|
This object resides in the UploadManager.Files collection and
represents an uploaded file.
Attributes As Long (Read/Write)
Sets and returns this file's system attributes. Can be a combination of file attribute
values defined in the AspUpload type library:
FILE_ATTR_READONLY = &H1
FILE_ATTR_HIDDEN = &H2
FILE_ATTR_SYSTEM = &H4
FILE_ATTR_DIRECTORY = &H10
FILE_ATTR_ARCHIVE = &H20
FILE_ATTR_NORMAL = &H80
FILE_ATTR_TEMPORARY = &H100
FILE_ATTR_COMPRESSED = &H800
Usage:
<!--METADATA TYPE="TypeLib" UUID="{B4E1B2DE-151B-11D2-926A-006008123235}"-->
Response.Write File.Attributes
File.Attributes = File.Attributes + FILE_ATTR_READONLY
Relevant Chapters: 6
Binary As Variant (Read-Only)
Returns the binary image of the file as a Variant-packed safe array of bytes.
Useful for saving files in the database using ADO.
Usage:
rs.AddNew
rs("image_blob).Value = File.Binary
rs.Update
Relevant Chapters: 4
ContentType As String (Read-Only)
Returns the uploaded file's Content-Type header value, such as "text/plain"
or "application/octet-binary".
Usage:
Response.Write File.ContentType
Relevant Chapters: N/A
CreationTime As Date (Read-Only)
Returns the file's Creation timestamp. This property is not defined if
this is a memory file.
Usage:
Response.Write File.CreationTime
Relevant Chapters: N/A
Ext As String (Read-Only)
Returns the file extension.
Usage:
Response.Write File.Ext
Relevant Chapters: 3
FileName As String (Read-Only)
Returns the saved file's name. It may be different from the original
file name if unique file generation (the property
Upload.OverwriteFiles) is in effect.
Usage:
Response.Write File.FileName
Relevant Chapters: 2
Folder As String (Read-Only)
Returns the saved file's folder. If this is a memory file,
the folder will be the same as the original folder.
Usage:
Response.Write File.Folder
Relevant Chapters: N/A
ImageHeight As Long (Read-Only)
Returns the pixel height of an image, or 0 if the file is not an image.
Formats supported are BMP, JPG, GIF, PNG and WEBP.
Usage:
Response.Write File.ImageHeight
Relevant Chapters: 7
ImageType As String (Read-Only)
Returns the image type. Possible return values
are "BMP", "GIF", "JPG", "PNG", "WEBP", and "TIF" for BMP, GIF, JPEG, PNG, WEBP and TIFF
images, respectively, and "UNKNOWN" if the file is not an image
or of an unknown image type.
Usage:
Response.Write File.ImageType
Relevant Chapters: 7
ImageWidth As Long (Read-Only)
Returns the pixel width of an image, or 0 if the file is not an image.
Formats supported are BMP, JPG, GIF, PNG and WEBP.
Usage:
Response.Write File.ImageWidth
Relevant Chapters: 7
LastAccessTime As Date (Read-Only)
Returns the file's Last Access timestamp. This property is not defined if
this is a memory file.
Usage:
Response.Write File.LastAccessTime
Relevant Chapters: N/A
LastWriteTime As Date (Read-Only)
Returns the file's Last Write timestamp. This property is not defined if
this is a memory file, unless the file is uploaded
with XUpload or JUpload, and the PreserveFileTime
feature is enabled.
Usage:
Response.Write File.LastWriteTime
Relevant Chapters: N/A
MD5Hash As String (Read-Only)
Returns the file's MD5 one-way hash value in the Hex format.
Usage:
Response.Write File.MD5Hash
Relevant Chapters: 4
Name As String (Read-Only)
Returns the value of the NAME attribute of this file's <INPUT TYPE=FILE> tag.
This property cannot be used to retrieve the file name, use FileName instead.
Usage:
Response.Write File.Name
Relevant Chapters: 2
OriginalFileName As String (Read-Only)
Returns the original name of the uploaded file.
Usage:
Response.Write File.OriginalFileName
Relevant Chapters: N/A
OriginalFolder As String (Read-Only)
Returns the original folder path of the uploaded file.
Usage:
Response.Write File.OriginalFolder
Relevant Chapters: N/A
OriginalPath As String (Read-Only)
Returns the original full path of the uploaded file.
Usage:
Response.Write File.OriginalPath
Relevant Chapters: N/A
OriginalSize As Long (Read-Only)
Returns the original size of the uploaded file. This value may be different
from the current size if file truncation is enabled via the
SetMaxSize method.
Usage:
Response.Write File.OriginalSize
Relevant Chapters: N/A
Path As Long (Read-Only)
Returns the full path of the uploaded file on the server.
Usage:
Response.Write File.Path
Relevant Chapters: 2
Size As Long (Read-Only)
Returns the size of the uploaded file on the server. It may be different
from the original size if the SetMaxSize feature is enabled.
Usage:
Response.Write File.Size
Relevant Chapters: N/A
Sub AllowAccess (Account As String, Flags As Long)
Adds an allowance access control entity (ACE) corresponding to the
specified NT Account to this file's Access Control List (ACL).
Flags must be a valid combination of Access Type values defined in
the file AspUpload.inc such as GENERIC_ALL. Other valid flag combinations include:
Read (RX):GENERIC_READ + FILE_GENERIC_EXECUTE
Change(RWXD): GENERIC_READ + GENERIC_WRITE + FILE_GENERIC_EXECUTE + DELETE
Full Control (All): GENERIC_ALL
Usage:
File.AllowAccess "jsmith", GENERIC_ALL
Relevant Chapters: 6
Sub Copy (Path As String, Optional Overwrite)
Copies this file to a location
specified by Path which must be a fully qualified path.
If Overwrite is set to True or omitted,
overwrites an existing file. If Overwrite is set to
False and a file at Path already exists, the method will fail.
Usage:
File.Copy "c:\newpath\" & File.FileName
Relevant Chapters: 3
Sub CopyVirtual (VirtualPath As String, Optional Overwrite)
Same as Copy, but expects a virtual rather than physical path.
If the system admin disables the Copy method, users are forced to use
CopyVirtual which confines them to their own home directory and subdirectories.
Usage:
File.CopyVirtual "/uploads/" & File.FileName
Relevant Chapters: 10
Sub Delete
Deletes the file.
Usage:
File.Delete
Relevant Chapters: 3
Sub DenyAccess (Account As String, Flags As Long)
Adds a denial access control entity (ACE) corresponding to the
specified NT Account to this file's Access Control List (ACL).
Flags must be set to GENERIC_READ.
Usage:
File.DenyAccess "jsmith", GENERIC_ALL
Relevant Chapters: 6
Sub ExtractFileName
Obsolete. Supported only for backwards compatibility.
Use FileName instead.
Usage:
Response.Write File.ExtractFileName
Relevant Chapters: N/A
Sub ExtractFolderName
Obsolete. Supported only for backwards compatibility.
Use Folder instead.
Usage:
Response.Write File.ExtractFolderName
Relevant Chapters: N/A
Sub Move (Path As String)
Copies this file to a location
specified by Path which must be a fully qualified path.
If a file at Path already exists, the method will fail.
Side effect: If the method succeeds, the File.Path property changes to the new path.
Usage:
File.Move "c:\newpath\" & File.FileName
Relevant Chapters: 3
Sub MoveVirtual (VirtualPath As String)
Same as Move, but expects a virtual rather than physical path.
Usage:
File.MoveVirtual "/uploads/" & File.FileName
Relevant Chapters: 10
Sub RevokeAllowance (Account As String)
Removes the corresponding allowance ACE from this file's ACL.
Usage:
File.RevokeAllowance "jsmith"
Relevant Chapters: 6
Sub RevokeDenial (Account As String)
Removes the corresponding denial ACE from this file's ACL.
Usage:
File.RevokeDenial "jsmith"
Relevant Chapters: 6
Sub SaveAs (Path As String)
Saves the file under the name specified by Path.
If UploadManager.OverwriteFiles is set to False and a file specified by
Path already exists, this method will generate a unique file name by
appending a numeric suffix such as (1), (2), etc. to the file name.
This method is especially useful when uploading to memory,
as this is the only way to save a memory file to disk.
Side effect: if the method succeeds, the
UploadedFile.Path property will be changed to Path
(or a unique file name derived from it).
Usage:
File.SaveAs "c:\path\" & File.FileName
Relevant Chapters: 4
Sub SaveAsVirtual (VirtualPath As String)
Same as SaveAs, but expects a virtual rather than physical path.
If the system admin disables SaveAs, users will be forced
to use SaveAsVirtual which confines them to their home directory
and subdirectories.
Usage:
File.SaveAsVirtual "/path/" & File.FileName
Relevant Chapters: 10
Sub SetOwner (Account As String, Flags As Long)
Sets the NTFS owner of this file to the NT Account specified.
Usage:
File.SetOwner "jsmith"
Relevant Chapters: 6
Sub ToDatabase (Connect As String, SQL As String, Optional MSAccessHeaders)
Saves the file specified to the database as a BLOB using ODBC.
Connect is an ODBC connection string which may use a system DSN,
or be DSNless, for example:
"DSN=mydb;UID=sa;PWD=xxxxx"
or
"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\path\db.mdb"
However Connect cannot be an ADO-style connection string, i.e. it
cannot reference an OLD DB provider, as this method is based on ODBC.
SQL is an SQL INSERT or UPDATE statement which uses the sign ?
as a placeholder for the file being saved in the database, for example:
"INSERT INTO mytable(image_blob, path) values(?, 'c:\path\file.ext')"
or
"UPDATE mytable SET imageblob = ? WHERE id = 15"
The MSAccessHeaders parameter may only be used with MS Access databases.
If set to True, AspUpload will attempt to save the file not as a Blob but as
an OLE Object so that the document can be invoked directly from MS Access
by double-clicking on the table field. This feature will only work with
file types for which OLE document servers exist, such as MS Word documents (*.doc),
Excel workbooks (*.xls), bitmaps (*.bmp), etc. For other types of files
(such as *.gif) the MSAccessHeaders parameter will be ignored and assumed False.
Note that you will not be able to download a document saved as an OLE Object
directly to the browser.
Usage:
File.ToDatabase "DSN=mydb;UID=sa;PWD=xxxx;", "insert into myimages(image_blob) values(?)"
Relevant Chapters: 4
|
|
 |
Copyright © 1998 - 2020 Persits Software, Inc.
All Rights Reserved
AspUpload® is a registered trademark of Persits Software, Inc. |
|
|
|
|