1

I have an ASP page, in which the user chooses a value (e.g drawingId) from a list box, and according to this value, ASP builds/calculates a file path, e.g. c:\drawings\file1.pdf, in order to show this pdf file to the user. This path refers to the client's computer, where these pdf files are stored. The server queries the database and knows only the association between the drawingId and the path at the client's computer.

How can I open this pdf file?

I've read similar questions, like How can my web application written in Java open a file on the client side? or Can javascript access a filesystem?, but I haven't understood how to proceed.

I would like this to work with all browsers and also implement this functionality in a PHP site.

Community
  • 1
  • 1
Martha
  • 11
  • 2
  • 1
    Why don't just [generate the PDF on the server](http://classicasp.aspfaq.com/components/how-do-i-generate-pdf-files-from-asp.html) and offer a download functionality to the client? – pankar Jul 26 '12 at 08:46
  • 1
    what? is opening a file where? im confused. –  Jul 26 '12 at 08:53
  • I can't generate the PDFs on the server. They are drawings created with Autocad and then saved as pdf at the client. – Martha Jul 26 '12 at 09:03
  • You can ask the users to select the pdf file from their local machine and upload it instead of asking to select an id. – Karan Punamiya Jul 26 '12 at 09:28
  • I tried opening it with Javascript, window.location.href="c:\drawings\file1.pdf", but it doesn't understand the address. We need to have a url there. And a url would refer to a location at the server. – Martha Jul 26 '12 at 10:00

3 Answers3

1

Use file:/// e.g. file:///c:/filename.pdf

SpaceBeers
  • 13,617
  • 6
  • 47
  • 61
Ham1979
  • 41
  • 5
0

Well I guess after user selects option from a list box, you could construct the path and redirect user to that path which should open the pdf file

eg.

file:///C:/foldername/filename.pdf
Dr. Dan
  • 2,288
  • 16
  • 19
  • I created an tag, My pdf, but it dosn't do anything when I click it. But does this link mean that the file is at the client's side or stored at the server? – Martha Jul 26 '12 at 10:46
0

it not possible to open client side file from server side code as it running at server side, also due to some security reason browser does not allow to browse client location

refer link Open local folder from link