I'm new to this world so please forgive me if this is a silly question.
I was wondering if it was possible to have a recordset of pdf files that can be displayed to a user in the form of a drop down menu, using ASP / stored procedures etc. When a user selects a specific file they want tio view they can then select it and load it in a new window?
I think, guess, that it is, but dont know where to start? Perhaps create the table populate with some test data. Write some code in the ASP page. Use STore procedure to populate the drop down menu....and then im stuck.
To get started, you may want to explore where your pdf's are going to be stored. If you choose to store them on disk, it simply becomes a matter of keeping track of where all your pdf's are and using ASP to direct the user to the correct pdf based on a menu selection (which will be passed as a form variable on post).
No need. Unless you're trying to hide your PDF's from being "linkable". You can keep a database that stores where all your pdf's live and use ASP to resolve a "pdf_id" to a path, then squirt that in to a page.
So far i have, a table with the names of the pdfs. and I also have the location of the pdf in the table, altho' i dont think thats entirely correct.
I have also created a drop down menu for these pdfs and they can be viewed.
Here is ASP:
SELECT PDF LISTINGS <select onchange="window.open(this.value, '_blank');" name="zoneID" id="Select2">
<option value="0" > - Display Types - </option>
sSQL = "exec spGetDisplayTypes"
SET oRS = oDB.Execute(sSQL)
If Not oRS.EOF Then
While Not oRS.EOF
But how do i get them to link to each pdf. I think this i the second bit of your reply, the pdf_id, but dont know how i would begin to do that?
I think what Teddy is talking about is if you don't want your users to be able to see where the PDF files are actually located on your server.
If you don't mind them seeing the correct URL to the PDF in their browser address bar, then just put the location of the PDF into the "value" field of each <option> tag, and your code above should open it up.
If you do mind, then you'll need to link to a 'download' ASP page that accepts the PDF ID, looks up the filename from the database, uses an ADODB.Stream to read its contents, and then uses Response.BinaryWrite to pump the stream contents back down to the browser as ContentType "application/pdf". It's not as complicated as it sounds, though