⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual_memory.html

📁 aspupload
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="KEYWORDS" content="ASP UPLOAD ASPUPLOAD PWS BLOB Personal Web Server IIS Internet Information Server ASP UPLOADING UPLOAD DEC ALPHA AlphaServer AspUpload Persits Software Persits Web ASP Active Server Pages Active Server Component Upload browser TYPE=FILE TYPE FILE Windows NT Web ACL ACE Access Control List Directory Listing Export Attribute FILE FREE RFC ie3 ie4 posting acceptor posting acceptor RFC1867 RFC-1867 1867 Component ENCTYPE multipart/form-data multipart SA-FileUp ActiveFile Database Multiple software artisans activefile vbscript activex jscript netscape internet explorer download downloading unique form limit size">
<meta name="KEYWORDS" content="ASP, UPLOAD, ASPUPLOAD, PWS, BLOB, Personal Web Server, IIS, Internet Information Server, ASP, UPLOADING, UPLOAD, DEC, ALPHA, AlphaServer, AspUpload, Persits Software, Persits, Web, ASP, Active Server Pages, Active Server Component, Upload, browser, TYPE=FILE, TYPE, FILE, Windows, NT, Web, ACL, ACE, Access Control List, Directory, Listing, Export, Attribute, FILE, FREE, RFC, ie3, ie4, posting acceptor, posting, acceptor, RFC1867, RFC-1867, 1867, Component, ENCTYPE, multipart/form-data, multipart, SA-FileUp, ActiveFile, Database, Multiple, software, artisans, activefile, vbscript, activex, jscript, netscape, internet, explorer, download, downloading, unique, form, limit, size">
<meta name="DESCRIPTION" content="AspUpload.com - the home of the most advanced upload solution for a Windows NT/ASP-based Web environment">
<TITLE>AspUpload.com - User Manual. Chapter 3</TITLE>
</HEAD>
<BODY BACKGROUND="bk.gif" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<BASEFONT FACE="Helvetica, Arial" SIZE=1>

<!-- Main Data table -->
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="705">
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="160">
<FONT FACE="arial narrow" Size=2>
<B>
	<IMG SRC="spacer.gif" BORDER="0" HEIGHT="15"><BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="index.html">Home</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="whatsnew.html">What's New</A>
	<P>
	<IMG SRC="sq.gif"><IMG SRC="square_pressed.gif"> <A HREF="manual.html">User Manual</A>
	<BR>

	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_intro.html">1. Introduction</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_simple.html">2. Simple Uploads</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small_pressed.gif"> 3. Memory Uploads<BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_db.html">4. Database</A><BR>	
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_progress.html">5. Progress Bar</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_security.html">6. Security</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_image.html">7. Images</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_unicode.html">8. Unicode</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_misc.html">9. Miscellaneous</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="sq.gif"><IMG SRC="square_small.gif"> <A HREF="manual_share.html">10. Hosting Issues</A><BR>

	<P>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="objectreference.html">Object Reference</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="livedemo.html">Live Demos</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="support.html">Support</A>
	<P>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="xupload.html">XUpload</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="jupload.html">JUpload</A><BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="aspjpeg.html">AspJpeg</A><BR>
	<P>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="download.html">Download</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="purchase.html">Purchase</A>
	<P>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="clients.html">Clients</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="otherproducts.html">Other Products</A>
	<BR>
	<IMG SRC="sq.gif"><IMG SRC="square.gif"> <A HREF="contact.html">Contact Us</A>


	<FORM TARGET="_new" ACTION="http://support.persits.com/emails/signup.asp">
	<FONT FACE="Arial Narrow" SIZE="2" COLOR="#9C3131"><IMG SRC="sq.gif"><B>Newsletter Signup</B></FONT><BR>
	<IMG SRC="sq.gif"><INPUT TYPE="TEXT" NAME="email" SIZE="15" VALUE="e-mail address"></FORM>
</B>
</FONT>
</TD>
<TD VALIGN=TOP WIDTH=545 ALIGN="LEFT">
<!-- Right Column with data -->
<IMG SRC="sq.gif"><BR>
<IMG SRC="manual.gif">
<BR>
<TABLE WIDTH=540 HEIGHT=2 CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TD BGcolor="#FFCE00"><spacer type=block width=540 height=2></TD>
</TABLE>
<P>	
	<FONT SIZE=2 FACE=ARIAL COLOR="#000000">

	<A HREF="manual_db.html"><IMG BORDER="0" SRC="next.gif" ALIGN="RIGHT" ALT="Chapter 4: Saving Files and/or Filenames in the Database"></A>
	<A HREF="manual_simple.html"><IMG BORDER="0" SRC="previous.gif" ALIGN="RIGHT" ALT="Chapter 2: Uploading Files and Text Items"></A>
	
	<B><U><FONT SIZE="3" COLOR="#990000">Chapter 3. Uploading to Memory</FONT></U></B>
	<P>
	
	<B><FONT COLOR="#0000A0">Calling Upload.Save with no Arguments</FONT></B>
	<BLOCKQUOTE>
	The <I>Path</I> parameter to the method <B>Upload.Save</B> 
	is optional: the method can be called with no arguments at all, as follows:
	<P>
	<FONT FACE="Courier New" SIZE="2">
	<B>
	Set Upload = Server.CreateObject("Persits.Upload")<BR>
	Upload.Save
	</B>
	</FONT>
	<P>
	If a folder path is not passed in, the Save method does not save
	uploaded files to disk. Instead it creates memory images of the files
	that can be accessed via the Upload.Files collection. A memory file
	can then be saved to disk via the <B>File.SaveAs</B>
	method. You may also use the property <B>File.Binary</B>
	to save the file in the database, as shown in the next chapter.
	<P>
	Note that AspUpload 2.x used the method <B>Upload.SaveToMemory</B>
	to perform memory uploads. This method is still supported for backwards
	compatibility, but it is equivalent to Upload.Save with the <I>Path</I> argument omitted.


	</BLOCKQUOTE>

	<B><FONT COLOR="#0000A0">Why Upload to Memory</FONT></B>
	<BLOCKQUOTE>
	Memory uploads provide several major advantages over regular uploads:
	<UL>
	<LI><B>Access to form items</B>. You cannot access
	text fields on your form until after the Save method is called. Therefore, if you need to access a form item
	before saving a file to disk, uploading to memory is the only way to do it.
	<LI><B>Access to file names</B>. You can check
	whether a file with the same name already exists in a directory
	before saving the uploaded file to disk.
	<LI><B>Simplified renaming and copying</B>. A regular upload saves all the files
	in the same directory, and under their original names. Uploading to memory
	makes the task or renaming and copying files easier to code.
	<LI><B>Performance and security</B>. If the ultimate destination
	of an uploaded file is a database table, you can use memory uploads
	to save your file in the database directly from memory without saving it to disk first.
	</UL>
	<P>
	The main disadvantage of memory uploads is that it cannot be used with
	large files as it is very memory-intensive. You should always use 
	SetMaxSize with memory uploads to limit the size of the memory imprints of files.

	</BLOCKQUOTE>

	<B><FONT COLOR="#0000A0">Accessing Form Items</FONT></B>
	<BLOCKQUOTE>
	The following code sample enables a user to select a destination
	subdirectory underneath the c:\upload folder to upload a file to.
	The sample form (file <B>formitems.asp</B>) contains a file item
	and a drop-down list box:
	<P>
	<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
	<TR><TD BGCOLOR="#E0E0E0">
	<FONT SIZE="1" FACE="Courier New">
	&lt;HTML><BR>
	&lt;BODY BGCOLOR="#FFFFFF"><P>

	&lt;h3>Using memory uploads to access form items&lt;/h3><P>
		
	&nbsp;&nbsp;&nbsp;&lt;FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="formitems_upload.asp"><BR>
	&nbsp;&nbsp;&nbsp;Select file: &lt;INPUT TYPE="FILE" SIZE="40" NAME="FILE1">&lt;BR><BR>
	&nbsp;&nbsp;&nbsp;Select destination subdirectory:<P>

	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;SELECT NAME="Subdir"><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION>Folder1&lt;/OPTION><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION>Folder2&lt;/OPTION><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;OPTION>Folder3&lt;/OPTION><BR>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/SELECT><BR>
	&nbsp;&nbsp;&nbsp;&lt;BR><BR>
	&nbsp;&nbsp;&nbsp;&lt;INPUT TYPE=SUBMIT VALUE="Upload!"><BR>
	&nbsp;&nbsp;&nbsp;&lt;/FORM><BR>

	&lt;/BODY><BR>
	&lt;/HTML><BR>
	</FONT></TD></TR>
	</TABLE>
	<P>
	The corresponding upload script <B>formitems_upload.asp</B>
	uploads the file to memory, then creates a user-specified subfolder
	and saves the file in it:
	<P>
	<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=3>
	<TR><TD BGCOLOR="#FFFF00">
	<FONT SIZE="1" FACE="Courier New">
	&lt;HTML><BR>
	&lt;BODY><BR>

	&lt;%<BR>
		Set Upload = Server.CreateObject("Persits.Upload")<P>

		</B>' we use memory uploads, so we must limit file size<B><BR>
		Upload.SetMaxSize 100000, True<P>

		</B>' Save to memory. Path parameter is omitted<B><BR>
		Upload.Save<P>

		</B>' Access subdirectory specified by user<B><BR>
		subdir = Upload.Form("subdir")<P>

		</B>' Build path string<B><BR>
		Path = "c:\upload\" & subdir<P>

		</B>' Create path, ignore "already exists" error<B><BR>
		Upload.CreateDirectory Path, True<P>

		</B>' Save files to it. Our form has only one file item<BR>
		' but this code is generic.<B><BR>
		For Each File in Upload.Files<BR>
		&nbsp;&nbsp;&nbsp;File.SaveAs Path & "\" & File.FileName<BR>
		&nbsp;&nbsp;&nbsp;Response.Write "File saved as " & File.Path & "&lt;BR>"<BR>
		Next<BR>
	%><BR>

	&lt;/BODY><BR>
	&lt;/HTML>
	</FONT></TD></TR>
	</TABLE>
	<P>
	Click the link below to run this code sample:
	<P>
	<B><A TARGET="_new" HREF="http://localhost/aspupload/03_memory/formitems.asp">http://localhost/aspupload/03_memory/formitems.asp</A></B>
	&nbsp;<A HREF="javascript:;" OnClick="open('helppopup.html','','width=400,height=400');"><IMG SRC="help.gif" BORDER="0" ALT="Why is this link not working?"></A>
	</BLOCKQUOTE>

	<B><FONT COLOR="#0000A0">Accessing File Names</FONT></B>
	<BLOCKQUOTE>
	The next code sample uploads a file to memory, the checks whether
	a file with the same name already exists in the destination directory,
	and if so, alerts a user. Otherwise the file is saved to disk.
	The form file <B>filename.asp</B> contains a single file item and is not shown here. 
	The corresponding upload script <B>filename_upload.asp</B> uses the method
	<B>FileExists</B> to determine whether the file already exists:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -