Be the first to write a review
FREE! Building A File Upload and Rating Application Support
Following on from his free tutorial on building a Content Management System with Server Behaviours and the Advanced HTML Editor, Matt shows how build a site that allows users to upload their own files, and rate those files. There's also a password-protected moderator's area so that you can be sure that all files can be checked before being made "live".
This free tutorial is suitable for beginners and uses only built-in Dreamweaver server behaviors and the DMXzone Pure ASP/ ASP.NET Upload Extensions! The uploading element is also PHP compatible, but the "rating" system doesn't work with PHP since it has no Command behavior to do the rating with.
Building Uploaderconfirm.asp
The uploader confirm page lets the user know their file has been uploaded correctly, and provides a link back to the uploaderview.asp page. Create a simple page like the one below, using some basic HTML and the upload.css file:
Now to give some feedback on which file it actually was, we'll use the bindings panel.
Hit + > Request Variable and give it the name title.
Highlight your song from the page, and in the bindings panel, select the
binding you just created. Click the insert button at the base of the Bindings
panel:
This will insert the URL parameter we passed from the previous page. Save and close the file.
Building Uploaderview.asp
Uploaderviewer.asp is a fairly simple page, containing all the elements necessary to page through our uploaded files.
Create a page with the title "Jazz Downloads". Put a table on the page with 2 rows and 5 columns. The headers should be: Song, summary, file, Current Rating and Rate Song.
Go to the application panel, and in Bindings click + > Recordset (Query)
Create a query called songs using the information given above. We're selecting all the items from the cms_uploads table, where the live column is set to y. This means we retrieve every song that the moderator has checked and made live.
Put the cursor in the first cell of the 2nd table row. Then in the Bindings window go to the Songs recordset and select the title column. Click the insert button. Repeat for the summary and current rating cells.
In the file cell, add the text "download" and highlight the text and browse for a new link using the properties panel. At the top of the dialog, switch from file System to Data Sources as we want the information to come from the database. Your songs recordset should appear. Select the name column and click OK.
In the rate song cell put the text: "1 | 2 | 3 | 4 | 5". Each of these numbers will be a rating link for the item.
Highlight the number 1. Go to the properties panel and create a link to the uploaderrating.asp page. Click the parameters button and add two parameters: Id, taken from the songs recordset so we know which song we're rating, and newrating which has a set value of "1".
Repeat this for the other numbers, but with the correct value for newrating for each one.
Matt Machell
A man of many talents, Matt has been a web designer, technical editor, and jewellery picker. He is currently on contract for the Birmingham City University, producing pages for research centres.
He has tech-edited a dozen books on web design and development for glasshaus, Apress and Sitepoint.
He likes music with loud guitars and games with obscure rules.
His website can be found at: http://www.eclecticdreams.com
He lives in Birmingham with his girlfriend, Frances, and a horde of spider plants.