Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


What about images?

July 10, 2000

Occassionally a writer may include an image with the article. Using the system as it is now, however, will not upload the images along with the document. You have to do these separately. This is a simple matter.

The first step should be to build an image tables, tblImages. This table should store the following info:

tblImages
IID Unique ID to keep track of records Autonumber
Filename The filename of the image Text
DocumentID The document in tblFiles that this image belongs to Number
Fixed Checks to see if correct image has been uploaded Boolean (Yes/No)

While these are the only required fields, you may also store the size information, as well as the page numbers that each image belongs to.

The upload process is simple. You'll have to go through the text of the document and find any images, ie, search for <img src="blah"> For every one of these you find, you should add an entry into tblImages. Then build a dynamic form - for each image entry in tblImages, add another upload button as you did in step 1. Then when an image is uploaded, flip the boolean field Fixed to true. If Fixed is true, then don't display the upload form for that image.

<%
Set Conn = Server.CreateObject("ADODB.connection")
Set rst = Server.CreateObject("ADODB.Recordset")
Conn.Open "dsn=my_db;DATABASE=my_db"


strSQL = "SELECT * from tblImages WHERE Fixed = False AND DocumentID = " & ID
rst.Open strSQL, Conn


if not rst.eof then
 do until rst.eof
 %>
 <form method="post" action="images.asp?ID=<% = ID %>" ENCTYPE="multipart/form-data">
  <% = rst("FileName") %>
  <input type="file" name="File">
  <input type="Submit" value=" Upload  " name="Submit">
 </form>
 <% rst.movenext
 loop
<% end if %>

For example, if we detect three images in the document, you'll first display three upload forms. When the user uploads the first image, check the Fixed boolean entry, and add the name of the image file to the database. The form will display again, but with only two upload forms this time. Wash. Rinse. Repeat.

Of course, this will do you no good if the image source in the HTML doesn't match the filename, so you'll have to go through the file one more time and change/verify the sources.

NOTE: When you upload images, note that the image name in the HTML source might not match the actual image filename. For example, if you insert an image called test1.gif into an MS Word Document and export it to HTML, Word sometimes automatically changes the HTML source to read image001.gif instead of test1.gif. Make sure that you put the proper name into the database, and update the HTML source to link to the correct image.

Step 3 - Layout
Content Management Made Easy with ASP
Administration


Up to => Home / Authoring / ASP / Content_Management




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers