PHP and Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ismael

    PHP and Javascript

    Hello all,

    I know this more a javascript rather than a php problem,
    but i searched internet and couldn't find an answer.

    Here it is : I simply want to know how to open a "Open File"
    or "Save File" box, after clicking an html button.

    I'm sure it's a three-lines-of-code problem :)
    Which class implements this ?

    Thank you very much

    Ismael
  • Hywel

    #2
    Re: PHP and Javascript

    In article <c5075d7d.04022 20940.5c0c3883@ posting.google. com>,
    ismael@club-internet.fr says...[color=blue]
    > Hello all,
    >
    > I know this more a javascript rather than a php problem,
    > but i searched internet and couldn't find an answer.
    >
    > Here it is : I simply want to know how to open a "Open File"
    > or "Save File" box, after clicking an html button.
    >
    > I'm sure it's a three-lines-of-code problem :)
    > Which class implements this ?[/color]

    <input type="file">

    --
    Hywel I do not eat quiche


    Comment

    • brotherli

      #3
      Re: PHP and Javascript

      Ismael wrote:[color=blue]
      > Hello all,
      >
      > I know this more a javascript rather than a php problem,
      > but i searched internet and couldn't find an answer.
      >
      > Here it is : I simply want to know how to open a "Open File"
      > or "Save File" box, after clicking an html button.
      >
      > I'm sure it's a three-lines-of-code problem :)
      > Which class implements this ?
      >[/color]

      To upload a file (get the "Open file" dialog) you place a form on your
      page with an <input type="file">.

      To force the browser to show a "Save file" dialog rather than
      displaying/opening the requested file you have to send an according
      mime-type within the HTTP header. This you can do with PHP:

      header('Content-Type: application/octet-stream');
      header('Content-Disposition: attachment; filename="myfil e.txt"');


      Regards

      --

      brotherli

      [ mails to nugs@brotherli. ch won't be read! replace nugs with endless. ]

      Comment

      Working...