The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Open local Excel file from webpage
rbwallis
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 18 2016, 07:07 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(rbwallis @ Jun 19 2016, 01:45 AM) *

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?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 19 2016, 05:52 AM
Post #4


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(CharlesEF @ Jun 19 2016, 02:16 AM) *

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. ohmy.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post 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



QUOTE(Christian J @ Jun 19 2016, 05:52 AM) *
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. ohmy.gif

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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 04:23 PM