The following code shows how to upload a file to a web directory and write that directory to an Access database.
Keep in mind that this is for users that are
on a PRE-MX (ColdFusion 5.0) environment. CFMX does not currently allow for
DNS-Less connections, due to a "restriction" with JDBC.
If the file exists, then upload it to the
server and process the request.
<cfif FORM.uploadedFile NEQ
''>
<CFFILE ACTION="upload"
FILEFIELD="uploadedFile"
DESTINATION="d:\Inetpub\wwwroot\ccm\intranet\ccm\documents\upload\"
NAMECONFLICT="MAKEUNIQUE">
<cfset upload_file = file.serverfile>
<cfoutput>
#serverFile# successfully added.
Size of the uploaded file: #Numberformat(Evaluate(File.FileSize/1024))#
KB.
</cfoutput>
<br>
<cfset DBPath="d:\Inetpub\wwwroot\ccm\intranet\ccm\documents\Uploads.mdb">
<cfquery name="test"
datasource="#DBPath#"
dbtype="OLEDB"
provider="Microsoft.Jet.OLEDB.4.0"
providerdsn="#DBPath#"
username="Admin"
password="">
INSERT INTO document (documentName)
VALUES ('d:\Inetpub\wwwroot\ccm\intranet\ccm\documents\upload\#upload_file#')
</cfquery>
</cfif>