Open local Excel file from webpage |
Open local Excel file from webpage |
rbwallis |
Jun 18 2016, 06:45 PM
Post
#1
|
Group: Members Posts: 1 Joined: 18-June 16 Member No.: 24,342 |
Hello all, I'm Robert, new here. I'm coding a website at the moment that runs a php script that, when a button is clicked, downloads an excel file to the user's "downloads" folder. I then want the user to click on another button to open that file in Excel.
This is the code for the first action, but I don't know how to code the running of the file from the user's machine. CODE <!-- Button to download setup file --> <form method="link" action="quikbotssetup.php"> <button type="submit">Download Beta Test File 1</button> </form> Any help would be appreciated. Thanks, Robert |
Christian J |
Jun 18 2016, 07:07 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
Hello all, I'm Robert, new here. Hello! QUOTE I'm coding a website at the moment that runs a php script that, when a button is clicked, downloads an excel file to the user's "downloads" folder. I then want the user to click on another button to open that file in Excel. I don't think a web page can access anything in your local file system. Why not simply link to the Excel file on your server instead? |
CharlesEF |
Jun 18 2016, 07:16 PM
Post
#3
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
Not every user will use the 'Downloads' directory. This means you might not know the correct path to your Excel file. If you want to try anyway then you could use the PHP command 'exec()', just supply the path/filename to your downloaded Excel file (not to mention you would need the complete path to the Downloads directory). On Windows computers the file association will take care of loading Excel, regardless of the install location (this assumes the Excel file has a valid Excel extension). On non-Windows computers I have no idea how to find the install path for Excel.
I suggest you let the uses load it themselves. This post has been edited by CharlesEF: Jun 18 2016, 07:18 PM |
Christian J |
Jun 19 2016, 05:52 AM
Post
#4
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
If you want to try anyway then you could use the PHP command 'exec()', just supply the path/filename to your downloaded Excel file (not to mention you would need the complete path to the Downloads directory). Are you saying exec() can start programs on the user's computer? I thought it was for starting programs on the server. If the PHP engine really can access the user's computer like that (how, BTW?) it sounds like a terrible security hole. |
CharlesEF |
Jun 19 2016, 06:38 AM
Post
#5
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
Are you saying exec() can start programs on the user's computer? I thought it was for starting programs on the server. If the PHP engine really can access the user's computer like that (how, BTW?) it sounds like a terrible security hole. You could be correct. I have done this using VBScript and WordPerfect macros. I only mention this because I have helped another user on this forum with PHP code to run python scripts. But I have never loaded a file in a local install of Excel from a web server, so maybe it can't be done. I'm not 100% sure it can/can't be done. This post has been edited by CharlesEF: Jun 19 2016, 06:38 AM |
Lo-Fi Version | Time is now: 26th April 2024 - 08:00 PM |