- What browsers are compatible with .asp files?
- How do I upload to a data directory?
- How do I upload to a database?
- How do I upload an image from my database to a web page?
The following information should get you started using ASPUpload. For detailed information please see the ASPUpload User Manual.
What browsers are compatible with .asp files?
You may use the following browsers (RFC 1867-compliant) to upload files:
- Netscape 3.0 and higher.
- Microsoft Internet Explorer 4.0 and higher.
How do I upload to a data directory?
You may upload up to three files and the corresponding asp script to a data directory by creating the following HTML form:
- upload.html
<HTML> <BODY BGCOLOR="#FFFFFF"> <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="upload.asp"> <INPUT TYPE= FILE SIZE= 60 NAME="FILE1"> <BR> <INPUT TYPE= FILE SIZE= 60 NAME="FILE2"> <BR> <INPUT TYPE= FILE SIZE= 60 NAME="FILE3"> <BR> <INPUT TYPE="SUBMIT" VALUE="Upload!"> </FORM> </BODY> </HTML>
- upload.asp
<% Set Upload = Server.CreateObject ("Persits.Upload.1") Count = Upload.SaveVirtual ("/data") %> <% = Count %> file(s) uploaded
How do I upload to a database?
You may upload three files to a database by creating the following HTML form:
- dataupload.htm
<HTML> <BODY BGCOLOR="#FFFFFF"> <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="DataUpload.asp"> <INPUT TYPE=FILE NAME="FILE1"><BR> <INPUT TYPE=FILE NAME="FILE2"><BR> <INPUT TYPE=FILE NAME="FILE3"><BR> <INPUT TYPE=TEXT NAME="DESCRIPTION"><BR> <SELECT NAME="CATEGORY" MULTIPLE> <OPTION>Image <OPTION>Text <OPTION>Source Code <OPTION>Archive </SELECT><BR> <INPUT TYPE=SUBMIT VALUE="Upload!"> </FORM> </BODY> </HTML>
- dataupload.asp
Uploading files to a to a database requires a few more lines of code than that of a data directory as follows:
<% Set Upload = Server.CreateObject ("Persits.Upload.1") ' Upload files ' Generate unique names Upload.OverwriteFiles = False ' Truncate files above 1MB Upload.SetMaxSize 1048576 ' Save to data directory Upload.SaveVirtual "/data" ' Process all files received For Each File in Upload.Files ' Save in the database as blob File.ToDatabase "DSN=userid.dsn_name;UID=user_id;PWD=account_Password;",_"insert into UploadTable (id, FilePath, image)values (12, '" & File.Path & '",?)" Next ' Display description field Response.Write Upload.Form ("Description") & "<BR>" ' Display all selected categories For Each Item in Upload.Form If Item.Name = "Category" Then Response.Write Item.Value & "<BR>" End If Next %>
How do I upload an image from my database to a web page?
To include an uploaded image from your database in a web page you can use a regular <IMG> tag in your HTML page with the SRC attribute pointing to the asp script. Please see the following examples:
- getimage.htm
<HTML> <BODY<br> <IMGSRC="getimage.asp?id=12"> </BODY> </HTML>
- getimage.asp
<% Set Upload = Server.CreateObject ("Persits.Upload.1") Set db = Server.CreateObject("ADODB.Connection") db.Open "userid.dsn" Set rs =db.Execute("SELECT image FROM uploadTable where id = " & Request("id") Response.ContentType = "image/gif" ' (or "image/jpeg") Response.BinaryWrite rs("image") %>
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771