Question

I am developing a Perl program, and I have to produce a .csv file containing the data obtained from an executed query. My program works well, and it produces the .csv file correctly and into the path I want, which is D:\\Tabelle\name_of_the_csv_file.csv . My inetpub folder is inside the C:\\ drive, so the program.

The problem is, I generate an HTML page containing a button with the "onclick" property set to window.open(D:\\Tabelle\name_of_the_csv_file.csv), in order to allow the user to download the file if he wants, but when I click on it, it just opens a blank page, without anything inside it. Here's the HTML part of my page where I have the button:

     <form action='' method=get>
         <table align="center">
           <tr>
                <td align="center" colspan=3>
                       <input align="middle" type=button name="csvObtain" value="Esporta tabella in .csv" onclick="window.open('d:\tabelle\Tabella-2012-8-8-12.11.30.csv')">
                </td>

           </tr>
         </table>
    </form>

Could someone help me resolving this? Do I have to create a different JavaScript?

Was it helpful?

Solution

using window.open like this ,

   window.open(D:\Tabelle\name_of_the_csv_file.csv)

it shall refer to the path on client machine, since the path is in javascript. if you want the file to be available as downloadable item, just map the D\tabelle folder as child directory(virtual dir) in your application and use relative path for the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top