+ Reply to Thread
Results 1 to 9 of 9

PHP Excel disable save

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    5

    PHP Excel disable save

    i don't know how to disable save after file have already download. Can everyone help me?
    i use PHP to make attachment to excel file.

    thx

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PHP Excel disable save

    Wouldn't that defeat the object of making a file available for downloads?

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: PHP Excel disable save

    i use header function :

    -----------------
    PHP Code: 
    $link=excel.xls;
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Type:application/octet-stream");
    header("Content-Length: " .(string)(filesize($link)) );
    header('Content-Disposition: attachment; filename="'.basename($link).'"');
    header("Content-Transfer-Encoding: binary");
    readfile($link);
    exit(); 
    -----------------

    but it just download file. i want user download file but user can't save again the file. So, i must disable save button in excel.
    May you help me?

    Thank you very much
    Last edited by Cutter; 08-31-2012 at 09:38 PM. Reason: Added code tags

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PHP Excel disable save

    I don't think you can, it would be pretty pointless anyway - couldn't they just copy and paste to another workbook?

  5. #5
    Registered User
    Join Date
    08-31-2012
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: PHP Excel disable save

    the file of download can be copy and paste to another workbook.

    But, it is still can be save. It's a problem. Because i want to make user can't save the file after they download the file. So, they only can read the file.

    Do another solution to make user can read only after download? So, they can't save the file.

    Thx

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PHP Excel disable save

    Don't let them download it? Just display the values on the page?

  7. #7
    Registered User
    Join Date
    08-31-2012
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: PHP Excel disable save

    no,they can download and save in the harddisk. But, they can read only. They can't save the file. So, they can't edit the file.

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PHP Excel disable save

    So your actual question of I've understood correctly is how can you make an excel file read only in php?

    Firstly, this is an excel forum, not a php forum so you're unlikely to get any help. However,list me see if I can give you a few pointers. You haven't said how you are creating the file, but I'm going to assume you're not just creating a csv file an renaming it. Sine you're creating an xls file rather than an xml based one you will be using some third party classes to achieve this functionality, the option to create the file as read only should be offered by them as a function.

    I just don't really get the point though since they can just copy the contents to a new workbook and save over the top

  9. #9
    Registered User
    Join Date
    08-31-2012
    Location
    Surabaya, Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: PHP Excel disable save

    yes.,oh. thank you very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1