how to invoke a bat file from server to client in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymohank
    New Member
    • Jan 2008
    • 29

    how to invoke a bat file from server to client in php

    Hello friends........ . i am new to php. In my project i have to download a java page from a bat file, to the client side by passing values from the program. the problem is that i am getting the java page in my system, but when i try to run the program from another system, the page gets downloaded to my system, not on the system from which i called the program.. ie its running in the server,but not coming to the client side.... how can i solve this problem...
    my friends told that i need to write the code for downloading the java page to get iton client, but i dont know how to write the code for downloading....

    Does any one knows the solution for my problem....

    thanks .
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    The best way to be sure that user will get a download dialog is to use a simple PHP script. it forces the browser to open download dialog.[php]<?php
    $file = $_GET['file'];
    header("Content-type: xxxxxxx");
    header("Content-Disposition: attachment; filename=". $file);
    readfile($file) ;
    ?> [/php]
    and use this link:
    Code:
    <a href="path_to.php?file=file_name">File Name</a>
    The Content-type of Java can be one of mthe following:
    Code:
    application/java
    application/java-class
    application/x-java-applet
    application/x-java-vm
    
    or just plain:
    application/octet-stream
    Ronald

    Comment

    • ajaymohank
      New Member
      • Jan 2008
      • 29

      #3
      thanks ronald... but my problem is to invoke the java page from the bat file, not to get the download dialogbox. when i am using this[php]<?php
      $file = $_GET['file'];
      header("Content-type: xxxxxxx");
      header("Content-Disposition: attachment; filename=". $file);
      readfile($file) ;
      ?>[/php] i am getting the download dialogbox. but i want to invoke the java page from the bat file. i am not able invoke the bat file to the client , i am getting the java page only on the server....

      is there any solution for this.....
      Last edited by ronverdonk; Apr 16 '08, 06:21 PM. Reason: use code tags!!

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        warning

        Please enclose your posted code in [code] tags (See How to Ask a Question).

        This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

        Please use [code] tags in future.

        MODERATOR

        Comment

        Working...