Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing pointers to a .pdf or .doc file in SQL

Status
Not open for further replies.

JimmySkliff

Programmer
Dec 5, 2001
4
0
0
CA
Hello...

I'm presently stuck with a situation where I need to store a pointer in my database to an actual .pdf or .doc file on my server. I am using ASP as my front end and I need for users to access these files and also upload files to my DB from the web page...I'm not quite sure as how to do this. I have used a text data type in the past but not to store locations of files. If anyone has ever encountered this issue please let me know how I can accomplish this task.....................


Best Regards....And Thank You
 
Hello,

I know of two approaches based on WROX book on ASP, one is to upload files and save them as files on the server and store the pathname in the database, the other is to store the file in a text field in the database. The WROX author refers to these methods as the easy way and the hard way.

I use a third-party component, ASPUpload by Persits Software, to handle the upload process. I recommend it.

Given that the uploaded files are stored as files on the server, say in a folder in the application root named Exhibits, it is easy enough to generate links to them in the ASP script.

Code:
Response.write(&quot;<a href='Exhibits/&quot; + rsExhibitList(&quot;file_name&quot;).value + &quot;'>&quot; + rsExhibitList(&quot;file_name&quot;).value + &quot;</a>&quot;);

Thus when a person clicks on the link the browser will load the appropriate application, Acrobat or Word, to display the file.

I played with storing image files in image datatypes and retrieving them for display and I agree that is the hard way. If the files were simple text files then storing them in a text field would give the capacity to edit the contents in a SQL stored procedure using READTEXT and UPDATETEXT.

Richard
 
Thanks....All is well. I now know what you mean by the easy way and the hard way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top