473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Open a file from php script

30
Hi

I need to open MS excell from my script.
I am not sure if the exec() will be able to do this,but I have tried without success.

Can you tell me how my php program can open a file like info.xls ?
Aug 6 '10 #1
2 1325
Atli
5,058 Expert 4TB
Hey.

What do you mean by "open"? Do you want PHP to use the file or just pass it to the user?

If it's the former, then that's going to be a problem. The MS Office formats are proprietary; meaning that Microsoft alone can properly use them. Basically, you need to buy Office, and have it installed on the computer to be able to use the Office files.
Closest you will come to being able to read them is to use something like PHPExcel, which uses Microsoft's "standard" format (which they themselves fail to implement properly...)

If you just want to print it to the user, you can do that by simply setting the proper "content-type" header, and then passing the file through using readfile.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header('Content-type: application/vnd.ms-excel');
  3. readfile('/path/to/file.xsl');
  4. ?>
Aug 6 '10 #2
Tinus
30
Thanks Atli

I want to start MS excell automatically from the php script.
It should do a few things and then open a specific excell workbook for the user.
The user will have MS Excell installed.
So the user will not need to open excell by himself.

I also have to do the same thing with a .exe file.
Aug 6 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Aggelos I. Orfanakos | last post by:
Hello. Under Gentoo Linux, I issue: $ python timeit.py python: can't open file 'timeit.py' $ ls -al /usr/lib/python2.3/timeit.py -rw-r--r-- 1 root root 9833 Oct 19 02:17...
1
by: William Starr Moake | last post by:
Another problem with the browser-based WYSIWYG editor I'm trying to assemble using IE's design mode. This opens the selected page in the editor iframe named iView: <select name="template"...
4
by: JUV | last post by:
How could I close a window that it did not open with script without the confirm dialog box show up?
1
by: Jonatan | last post by:
Hi all, I'm trying to upload files doing something like gmail. I almost got it but I have a problem when I post the form. Basicaly, I am doing the following. When the user presses the link...
2
by: nissiml | last post by:
hi, i'm trying to open a asp.net web page that list files from a Windows application like winword and select a file from it . what do i have to do to make it happen, is it simple ? Thanks in...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
6
by: rahulthathoo | last post by:
Hi I have my home directory on my departments server. Somehow I am not able to write to a file using a php code, $myFile = "trial3.txt"; $fh = fopen($myFile, "a+") or die("can't open file"); ...
4
by: DyslexicAnaboko | last post by:
Hello, I have a module that is part of larger project that is giving me trouble, so I setup an example. Brief ===== I simply want to open a text file and make the contents avaliable...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
0
by: Kurt Jakobsen | last post by:
Hello, I am having problem to download files via a bat script from an ftp server. When I do it manually (typing the commands into the ftp prog) it works. However this is no option as there are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.