Important alert: (current site time 7/16/2013 6:36:34 AM EDT)
 

article

DSN-less Connection to Access / Uploading documents

Email
Submitted on: 9/15/2006 7:47:07 AM
By: FusionerMX  
Level: Intermediate
User Rating: Unrated
Compatibility: Cold Fusion 5
Views: 37322
author picture
(About the author)
 
     The following code shows how to upload a file to a web directory and write that directory to an Access database.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				

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>



Other 19 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
9/28/2006 2:10:39 AMIrshad

i want to retrieve the Microsoft Access database from the server, i have the server ip address. in asp.net we retrieve the Microsoft Access database from the server though server.mappath but in vb.net how to do it, i don't know plz help me, that's very urgent
(If this comment was disrespectful, please report it.)

 
10/17/2007 7:31:19 PMabdlrahman

Good job !!!
Thanks.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.