opening bianry files from hard disk

Discussion in 'ASP General' started by moony marouane, Dec 22, 2005.

  1. Hi all

    I'm looking for code regarding opening (not saving) binary files (pdf, word,
    excel...) from hard disk with asp, the website is hosted in C:\ and the pdf
    files are in D:\.
    Does anyone have an idea about this??

    Many thanks in advance.

    Moony.
     
    moony marouane, Dec 22, 2005
    #1
    1. Advertising

  2. moony marouane

    Evertjan. Guest

    moony marouane wrote on 22 dec 2005 in
    microsoft.public.inetserver.asp.general:

    > I'm looking for code regarding opening (not saving) binary files (pdf,
    > word, excel...) from hard disk with asp, the website is hosted in C:\
    > and the pdf files are in D:\.
    > Does anyone have an idea about this??


    binary stream

    http://www.aspfaq.com/show.asp?id=2161

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 22, 2005
    #2
    1. Advertising

  3. Many thanks for your reply Evertjan, but actually I'm looking for code to
    open files not to save them.

    To be more clear, I have an asp file (hosted in c:\ of my web server) that
    lists (filesystemobjects) the content of a folder in D:\, in this asp file I
    have in front of each file 3 links (download/print/open), the download link
    works great but not the 2 other links.

    when I use the absolute path and try to open the files from another pc (not
    the webserver where the website is hosted) it tries to look for it in the
    local computer and not the webserver so it gives "page can not be displayed"

    Hope I clarified my problem.

    Thanks again.

    Moony

    "Evertjan." <> a écrit dans le message de
    news:Xns9734C1545FA23eejj99@194.109.133.242...
    > moony marouane wrote on 22 dec 2005 in
    > microsoft.public.inetserver.asp.general:
    >
    > > I'm looking for code regarding opening (not saving) binary files (pdf,
    > > word, excel...) from hard disk with asp, the website is hosted in C:\
    > > and the pdf files are in D:\.
    > > Does anyone have an idea about this??

    >
    > binary stream
    >
    > http://www.aspfaq.com/show.asp?id=2161
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    moony marouane, Dec 24, 2005
    #3
  4. moony marouane

    Evertjan. Guest

    moony marouane wrote on 24 dec 2005 in
    microsoft.public.inetserver.asp.general:

    > "Evertjan." <> a écrit dans le message de
    > news:Xns9734C1545FA23eejj99@194.109.133.242...
    >> moony marouane wrote on 22 dec 2005 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > I'm looking for code regarding opening (not saving) binary files
    >> > (pdf, word, excel...) from hard disk with asp, the website is
    >> > hosted in C:\ and the pdf files are in D:\.
    >> > Does anyone have an idea about this??

    >>
    >> binary stream
    >>
    >> http://www.aspfaq.com/show.asp?id=2161
    >>


    [please do not toppost on usenet]

    > Many thanks for your reply Evertjan, but actually I'm looking for code
    > to open files not to save them.


    The below example gets a file from the server HD and then sends it to the
    client, not neccessarily for saving.

    ========== main.asp ================

    <a href='myPDF.asp'>read, not save myPDF.pdf</a>


    ====================================


    =========== myPDF.asp ==============

    <%
    pdf("myPDF.pdf")

    function pdf(x)
    Response.Clear

    strFileName="/mySecretFolder/" & x
    strFilePath=server.mappath(strFilename)

    '' or: strFileName="c:\myRootFolder\" & x

    Set objStream = Server.CreateObject("ADODB.Stream")
    objStream.Open

    objStream.Type = 1
    objStream.LoadFromFile strFilePath
    Response.ContentType = "application/pdf"
    Response.BinaryWrite objStream.Read
    objStream.Close
    Set objStream = Nothing
    Response.end
    end function
    %>

    =======================================


    > To be more clear, I have an asp file (hosted in c:\ of my web server)
    > that lists (filesystemobjects) the content of a folder in D:\, in this
    > asp file I have in front of each file 3 links (download/print/open),
    > the download link works great but not the 2 other links.
    >
    > when I use the absolute path and try to open the files from another pc
    > (not the webserver where the website is hosted) it tries to look for
    > it in the local computer and not the webserver so it gives "page can
    > not be displayed"
    >
    > Hope I clarified my problem.


    Not compleatly, but will the above help?



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 24, 2005
    #4
  5. "Evertjan." <> a écrit dans le message de
    news:Xns9736812A4B538eejj99@194.109.133.242...
    > moony marouane wrote on 24 dec 2005 in
    > microsoft.public.inetserver.asp.general:
    >
    > > "Evertjan." <> a écrit dans le message de
    > > news:Xns9734C1545FA23eejj99@194.109.133.242...
    > >> moony marouane wrote on 22 dec 2005 in
    > >> microsoft.public.inetserver.asp.general:
    > >>
    > >> > I'm looking for code regarding opening (not saving) binary files
    > >> > (pdf, word, excel...) from hard disk with asp, the website is
    > >> > hosted in C:\ and the pdf files are in D:\.
    > >> > Does anyone have an idea about this??
    > >>
    > >> binary stream
    > >>
    > >> http://www.aspfaq.com/show.asp?id=2161
    > >>

    >
    > [please do not toppost on usenet]
    >
    > > Many thanks for your reply Evertjan, but actually I'm looking for code
    > > to open files not to save them.

    >
    > The below example gets a file from the server HD and then sends it to the
    > client, not neccessarily for saving.
    >
    > ========== main.asp ================
    >
    > <a href='myPDF.asp'>read, not save myPDF.pdf</a>
    >
    >
    > ====================================
    >
    >
    > =========== myPDF.asp ==============
    >
    > <%
    > pdf("myPDF.pdf")
    >
    > function pdf(x)
    > Response.Clear
    >
    > strFileName="/mySecretFolder/" & x
    > strFilePath=server.mappath(strFilename)
    >
    > '' or: strFileName="c:\myRootFolder\" & x
    >
    > Set objStream = Server.CreateObject("ADODB.Stream")
    > objStream.Open
    >
    > objStream.Type = 1
    > objStream.LoadFromFile strFilePath
    > Response.ContentType = "application/pdf"
    > Response.BinaryWrite objStream.Read
    > objStream.Close
    > Set objStream = Nothing
    > Response.end
    > end function
    > %>
    >
    > =======================================
    >
    >
    > > To be more clear, I have an asp file (hosted in c:\ of my web server)
    > > that lists (filesystemobjects) the content of a folder in D:\, in this
    > > asp file I have in front of each file 3 links (download/print/open),
    > > the download link works great but not the 2 other links.
    > >
    > > when I use the absolute path and try to open the files from another pc
    > > (not the webserver where the website is hosted) it tries to look for
    > > it in the local computer and not the webserver so it gives "page can
    > > not be displayed"
    > >
    > > Hope I clarified my problem.

    >
    > Not compleatly, but will the above help?
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)


    Many thanks again for your reply, the code you gave me didn't work, it opens
    up the pdf file in the form of text.
    This one worked for me :
    http://support.microsoft.com/kb/276488/en-us
    Thanks again.
    Moony.
     
    moony marouane, Dec 26, 2005
    #5
  6. I can't see the difference between both solutions, but the second worked
    whereas the one you sent didn't work.
     
    moony marouane, Dec 26, 2005
    #6
  7. Hi again.

    I have another question, what about printing files without opening them, I
    have the URL of the file and I want to print it directly to printer (with
    message confirmation).
    Any help is too much appreciated.

    Thanks in Advance.
     
    moony marouane, Dec 26, 2005
    #7
  8. moony marouane

    Evertjan. Guest

    moony marouane wrote on 26 dec 2005 in
    microsoft.public.inetserver.asp.general:

    > Hi again.
    >
    > I have another question,


    [please do not start new questions on usenet with an old subject string.]

    > what about printing files without opening
    > them, I have the URL of the file and I want to print it directly to
    > printer (with message confirmation).
    > Any help is too much appreciated.
    >


    If you mean printing it on the client via a regular browser,
    that is and should be impossible with an internet security level.

    Further more that is not ASP-related so off topic in this NG.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 26, 2005
    #8
  9. I read once that there is a function that allows this, I just can't remember
    what is it.
    Anyway, thanks for your help.
     
    moony marouane, Dec 27, 2005
    #9
  10. moony marouane

    Evertjan. Guest

    moony marouane wrote on 27 dec 2005 in
    microsoft.public.inetserver.asp.general:

    > I read once that there is a function that allows this, I just can't
    > remember what is it.
    >


    Allows what?

    This is usenet, not email, so please quote.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 27, 2005
    #10
  11. "Evertjan." <> a écrit dans le message de
    news:Xns9739A21FBAB65eejj99@194.109.133.242...
    > moony marouane wrote on 27 dec 2005 in
    > microsoft.public.inetserver.asp.general:
    >
    > > I read once that there is a function that allows this, I just can't
    > > remember what is it.
    > >

    >
    > Allows what?
    >
    > This is usenet, not email, so please quote.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)


    as you can see I was replying to the message where you said that my question
    (about printing without opening the file from ASP) is not ASP-related and
    that it's off topic in this NG. My reply was that I read once that there is
    a function that allows printing from asp and that I can't remember what is
    this function or where I read it.
    :)
     
    moony marouane, Dec 27, 2005
    #11
  12. moony marouane

    Evertjan. Guest

    moony marouane wrote on 27 dec 2005 in
    microsoft.public.inetserver.asp.general:

    >
    > "Evertjan." <> a écrit dans le message de
    > news:Xns9739A21FBAB65eejj99@194.109.133.242...
    >> moony marouane wrote on 27 dec 2005 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > I read once that there is a function that allows this, I just can't
    >> > remember what is it.
    >> >

    >>
    >> Allows what?
    >>
    >> This is usenet, not email, so please quote.
    >>

    >
    > as you can see I was replying to the message where you said that my
    > question (about printing without opening the file from ASP) is not
    > ASP-related and that it's off topic in this NG. My reply was that I
    > read once that there is a function that allows printing from asp and
    > that I can't remember what is this function or where I read it.
    > :)


    Not in classic ASP, because that runs only on the server,
    and only sends a HTML [with headers and clientside code] to the client,
    while the printing has to be done clientside.

    About asp.net [not this NG's subject] I don't know.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Dec 27, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephane Guyetant

    Hard Disk Drive behavioral model

    Stephane Guyetant, Oct 2, 2003, in forum: VHDL
    Replies:
    0
    Views:
    580
    Stephane Guyetant
    Oct 2, 2003
  2. Ahmed Essa

    hard disk serial number

    Ahmed Essa, Nov 17, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    525
    Nick Hertl
    Nov 17, 2005
  3. Shonty

    SCSI Hard Disk Number

    Shonty, Jan 7, 2005, in forum: C++
    Replies:
    2
    Views:
    2,883
    Shonty
    Jan 7, 2005
  4. bjzhangwn

    seagate hard disk driver problem

    bjzhangwn, May 29, 2006, in forum: VHDL
    Replies:
    0
    Views:
    590
    bjzhangwn
    May 29, 2006
  5. Replies:
    12
    Views:
    535
    santosh
    Nov 15, 2006
Loading...

Share This Page