• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Uploading PDF files into an Access Database

Explorer ,
Dec 18, 2006 Dec 18, 2006

Copy link to clipboard

Copied

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?
TOPICS
Database access

Views

3.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2006 Dec 18, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 12, 2007 Feb 12, 2007

Copy link to clipboard

Copied

Once I have the file uploaded to the server (in the same path as the originating page), how do I then insert it into my database?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

You might look at topic "Storing Files in a DB" at http://developer.fusium.com/code/
I have not used this code sample, but it sounds like it might help you with your task.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

LATEST
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation