Skip navigation
Currently Being Moderated

Uploading PDF files into an Access Database

Dec 18, 2006 12:51 PM

I'm trying to upload a pdf file to an Access database (and eventually to a SQL Server database) using a file input type in a form, and sending it to a cfm page to do the dirty work. How am I supposed to construct the insert query (not using cfinsert) to upload the file?
  • Currently Being Moderated
    Dec 18, 2006 3:08 PM   in reply to pblecha
    Not sure if this is will help but here is how I add pdf files.

    I first upload the file to my server through a 'cffile' tag and then I set the Form fieldname to using the 'cffile.ClientFileName' and 'cffile.ClientFileExt' variables. I can then add the filename to the database.

    See code
    Mark as:
  • Currently Being Moderated
    Dec 19, 2006 9:21 AM   in reply to pblecha
    You might look at topic "Storing Files in a DB" at
    I have not used this code sample, but it sounds like it might help you with your task.
    Mark as:
  • Currently Being Moderated
    Dec 20, 2006 7:04 AM   in reply to tjestus
    I did look up cffile to use for this; however, the destination
    attribute, which is required, won't accept a database as a value. I'm
    not uploading to a server or a directory, so unfortunately, it's not
    helpful. But thanks.

    You are going to have to. As far as I know, you can not load a file
    directly from a client to a database server through a web server without
    first loading the file to the web server. I would imagine the steps
    would be something like this.

    Form to collect file to upload.
    Action page to load file to web server directory
    File is read from web server
    Store file in database.
    Mark as:
  • Currently Being Moderated
    Feb 14, 2007 9:22 AM   in reply to pblecha
    See Bob Dobbs' link above. Search for "cffile" in that page. It's probably the best copy-and-paste example you're going to find.
    <previous edit makes remainder of contents irrelevant />
    Read the file contents with CFFILE into a variable.

    Create a procedure that INSERTS a passed value into the field. It should be IMAGE datatype. Pass the variable to the stored procedure or insert query.

    It'd be nice to skip the Access step, BTW.
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points