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>

About This Tutorial
Author: Steve Moore
Skill Level: Intermediate 
 
 
 
Platforms Tested: CF5
Total Views: 86,679
Submission Date: September 15, 2003
Last Update Date: June 05, 2009
All Tutorials By This Autor: 1
Discuss This Tutorial
  • mobilephone housine for nokia 1100 2100 2112 3100 3120 3200 3220 3315 6100 6610 7210 7250 7260 7610 8210 8250 8310 moto v180 v220 c330 c350 v300 v400 siemens mc60 m55 m50 a50 a55 c55 c45 samsung ect ,mobilephone lcd ,case ,strip.

Advertisement

Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.