Something like this (using a form and then an action page):

First page (with form):

<form name="PDFUpload" method="POST" enctype="multipart/form-data"
action="uploadfile.cfm">
<h5>Filename:<br><input type="file" name="PDF" size="40"></h5>
<p><input type="submit" value="Upload File">
</form>

Followed with the action page called uploadfile.cfm:

<cffile action="upload" filefield="PDF"
destination="c:\uploadedpdffiles\" nameconflict="makeunique"
accept="image/gif,image/jpeg,image/jpg,image/pjpeg">

The above accepts only web image formats (Compuserve GIF, JPEG and
Progressive JPEG). I'm not sure what the mime type for Acrobat PDF is.
Perhaps www.adobe.com has the answer.

You should use ACCEPT to prevent executable files being uploaded and
then executed on the server (as an extra precaution). Also consider
having the files uploaded to a directory out of the web server scope to
avoid the chance of a malicious file being "executed" on the server. Ben
Forta's excellent Web Application Construction Kit
(http://www.forta.com/books/0789725843/) goes into this and many other
CF topics.

Highly recommended!

Peter Tilbrook
ColdFusion Applications Developer
Australia New Zealand Food Authority
Boeing House
55 Blackall Street
BARTON ACT 2600
Ph: +61-2-6271 2256
Fax: +61-2-6271 2278

http://www.anzfa.gov.au

-----Original Message-----
From: Willy Ray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 6 September 2001 2:49
To: CF-Talk
Subject: Browser client for upload files?


Alright, the client needs to upload a PDF file.  How do I let the user
browse their machine for the file to upload? I'd like to use CFTREE,
right?  I'm fuddled.

Willy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to