📄 object_upload.html
字号:
<A NAME="MoveFile">
Sub <FONT COLOR="#00A080"><B>MoveFile</B></FONT> (<I>FromPath</i> As String, <I>ToPath</i> As String)
<BLOCKQUOTE>
Moves a file from <I>FromPath</i> to <I>ToPath</i>.
<P>
This method will fail if the destination path exists.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.MoveFile "c:\path1\file.ext", "c:\path2\file.ext"
</FONT><P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="OpenFile">
Function <FONT COLOR="#00A080"><B>OpenFile</B></FONT> (<I>Path</i> As String) As Object
<BLOCKQUOTE>
Creates an instance of the <A HREF="object_file.html">UploadedFile</A> object
from the specified path on the server.
<P>
Useful if you want to take advantage of the
<A HREF="object_file.html#binary">UploadedFile.Binary</A> property to save
an arbitrary file to the database using ADO.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Set File = Upload.OpenFile("c:\path1\file.ext")
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_share.html">10</A>
</BLOCKQUOTE>
<A NAME="RegisterServer">
Sub <FONT COLOR="#00A080"><B>RegisterServer</B></FONT> (<I>Path</i> As String, Optional <I>Register</i>)
<BLOCKQUOTE>
Mimics the behavior of REGSVR32 (/u) utility.
Registers (unregisters) the specified ActiveX DLL. If <I>Register</i> is True
or omitted, the method registers the DLL, otherwise unregisters it.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.RegisterServer "c:\path1\file.dll"<P>
Upload.RegisterServer "c:\path1\file.ocx", False<P>
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_misc.html">9</A>, <A HREF="manual_share.html">10</A>
</BLOCKQUOTE>
<A NAME="RemoveDirectory">
Sub <FONT COLOR="#00A080"><B>RemoveDirectory</B></FONT> (<I>Path</i> As String)
<BLOCKQUOTE>
Removes the specified directory. This method fails if the directory
contains files or subdirectories.<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.RemoveDirectory "c:\path"
</FONT><P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="RevertToSelf">
Sub <FONT COLOR="#00A080"><B>RevertToSelf</B></FONT>
<BLOCKQUOTE>
Ends an impersonation begun by <A HREF="#LogonUser">LogonUser</A>.<P>
Usually there is no need to call this method as IIS ends all impersonations
automatically after the ASP page finishes.<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.RevertToSelf
</FONT><P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="Save">
Function <FONT COLOR="#00A080"><B>Save</B></FONT> (Optional <I>Path</i>, Optional <i>Key</i>, Optional <i>Ext</i>) As Long
<BLOCKQUOTE>
The main "workhorse" method which captures uploaded files,
saves them on disk or in memory, and populates
the Files and Form collections.<P>
<i>Path</i>, if specified, is the destination directory where files are to be saved.
<P>
If <I>Path</i> is omitted, files are saved in memory. A file in memory can be
accessed via the property <A HREF="object_file.html#Binary">File.Binary</A> or saved to hard drive via the
method <A HREF="object_file.html#SaveAs">File.SaveAs</A>.<P>
The <I>Key</i> and <i>Ext</i> parameters are to be used if you wish to
encrypt files being uploaded.
<i>Key</i> is a <B>CryptoKey</B> object creatable with the
<A HREF="http://www.aspencrypt.com">AspEncrypt</A> component.
If this parameter is specified, the files will be encrypted with this key
before being saved. <I>Ext</i>
is an optional extension which will be added to the original file name.
<P>
For more information on file encryption and decryption, visit the
AspEncrypt web site at <A HREF="http://www.aspencrypt.com/task_upload.html">www.aspencrypt.com/task_upload.html</A>.
<P>
<B>Return value:</B> the number of successfully uploaded files.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Count = Upload.Save ' save to memory<P>
Count = Upload.Save("c:\upload") ' save to hard drive<P>
Upload.Save "c:\upload" ' save to hard drive, ignore return value<P>
Upload.Save , Key, "xxx" ' Save to memory, encrypt with <I>Key</i><P>
Upload.Save "c:\upload", Key, "xxx" ' Save to hard drive, encrypt with <I>Key</i><P>
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_simple.html">2</A>, <A HREF="manual_memory.html">3</A>, and all others.
</BLOCKQUOTE>
<A NAME="SaveEncrypted">
Function <FONT COLOR="#00A080"><B>SaveEncrypted</B></FONT> (<I>Path</i> As String, <i>Key</i> As Object, <i>Ext</i> As String) As Long
<BLOCKQUOTE>
Obsolete. Supported for backwards compatibility only. Use <A HREF="#Save">Save</A> instead.
<P>
<FONT FACE="Courier New">
Upload.SaveEncrypted(Path, Key, Ext)<P>
</FONT>
is equivalent to
<P>
<FONT FACE="Courier New">
Upload.Save(Path, Key, Ext)
</FONT><P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="SaveToMemory">
Function <FONT COLOR="#00A080"><B>SaveToMemory</B></FONT> As Long
<BLOCKQUOTE>
Obsolete. Supported for backwards compatibility only. Use <A HREF="#Save">Save</A> instead.
<P>
<FONT FACE="Courier New">
Upload.SaveToMemory<P>
</FONT>
is equivalent to
<P>
<FONT FACE="Courier New">
Upload.Save
</FONT><P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="SaveVirtual">
Function <FONT COLOR="#00A080"><B>SaveVirtual</B></FONT> (Optional <I>VirtualPath</i>, Optional <i>Key</i>, Optional <i>Ext</i>) As Long
<BLOCKQUOTE>
Same as Save but expects a virtual path rather than a physical path.
This method internally calls the function Server.MapPath
to convert the virtual into physical path. Therefore,
Upload.SaveVirtual(path) is equivalent to Upload.Save(Server.MapPath(path)).
<P>
In a Web hosting environment, the system administrator may disable the
Save method so that an AspUpload user would be forced to use
SaveVirtual which would confine him to his home directory and subdirectories.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.SaveVirtual "/images"<p>
Upload.SaveVirtual "/images", Key, "xxx"
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_share.html">10</A>
</BLOCKQUOTE>
<A NAME="SaveVirtualEncrypted">
Function <FONT COLOR="#00A080"><B>SaveVirtualEncrypted</B></FONT> (Optional <I>VirtualPath</i>, Optional <i>Key</i>, Optional <i>Ext</i>) As Long
<BLOCKQUOTE>
Obsolete. Supported for backwards compatibility only. Use SaveVirtual instead.
<P>
<B>Relevant Chapters:</B> N/A
</BLOCKQUOTE>
<A NAME="SendBinary">
Sub <FONT COLOR="#00A080"><B>SendBinary</B></FONT> (<I>Path</i> As String, Optional <i>IncludeContentType</i>, Optional <i>ContentType</i>, Optional <I>Attachment</i>)
<BLOCKQUOTE>
Used for file downloading. Takes an arbitrary file specified by <i>Path</i>
on the server's hard drive and sends it to the client browser.
<P>
<I>IncludeContentType</i> is True by default. It controls
whether this method should build the Content-Type, Content-Disposition
and Content-Length headers. If set to False, the headers will not be built.
<P>
<I>ContentType</i> specifies the value for the Content-Type header.
<P>
<I>Attachment</i> is False by default. If set to True,
the keyword "attachment;" will be included in the
Content-Disposition header to force a Save As dialog box
instead of opening a file in-place in the browser.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.SendBinary "c:\path\file.ext", True, "application/octet-stream", True
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_misc.html">9</A>
</BLOCKQUOTE>
<A NAME="SetMaxSize">
Sub <FONT COLOR="#00A080"><B>SetMaxSize</B></FONT> (<I>MaxSize</i> As Long, Optional <i>Reject</i>)
<BLOCKQUOTE>
Specified the maximum allowed size of the individual files to be uploaded.
<I>Reject</i> specifies whether files larger than <I>MaxSize</i> should be rejected
(if set to True) or truncated (if set to False or omitted).
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.SetMaxSize 150000, True
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_simple.html">2</A>
</BLOCKQUOTE>
<A NAME="ToDatabaseEx">
Sub <FONT COLOR="#00A080"><B>ToDatabaseEx</B></FONT> (<I>Path</i> As String, <i>Connect</i> As String, <I>SQL</i> As String, Optional <I>MSAccessHeaders</i>)
<BLOCKQUOTE>
Saves an arbitrary file specified by <I>Path</i> to the database.
See the <A HREF="object_file.html#ToDatabase">UploadedFile.ToDatabase</A> method for the description of parameters Connect,SQL and MSAccessHeaders.
<P>
<B>Usage:</B><FONT FACE="Courier New"><P>
Upload.ToDatabaseEx "c:\path\file.txt", "DSN=mydb;", "insert into myimages(image_blob) values(?)"
</FONT><P>
<B>Relevant Chapters:</B> <A HREF="manual_db.html">4</A>
</BLOCKQUOTE>
<P>
<A HREF="object_file.html"><IMG BORDER="0" SRC="next.gif" ALIGN="RIGHT" ALT="UploadedFile Object"></A>
<P>
</BLOCKQUOTE>
</FONT>
<P>
<TABLE WIDTH=540 HEIGHT=2 CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TD BGcolor="#FFCE00"><spacer type=block width=540 height=2></TD>
</TABLE>
<P>
<CENTER>
<A HREF="index.html"><IMG SRC="logo_small.gif" BORDER=0></A>
<BR>
<FONT Face=arial size=1>
Copyright © 1998 - 2001 <A HREF="http://www.persits.com">Persits Software, Inc.</A><BR>
All Rights Reserved<BR>
AspUpload® is a registered trademark of Persits Software, Inc.<BR>
Questions? Comments? <A HREF="MAILTO:info@aspupload.com">Write us!</A>
</CENTER>
</TD>
</TABLE>
</BASEFONT>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -