开发者

PHP XLS.class Creating a READ-ONLY file. Help!

I am using an XLS class to create a spreadsheet file in PHP from a database downloaded from here: http://www.phpclasses.org/package/6583-PHP-Compose-and-generate-Excel-XLS-spreadsheet-files.html

The XLS files that are being generated seem to be READ ONLY. I cannot edit the file.

I need to be able to edit these files. Not even a CHMOD seems to work. Below is my code.

Please help, I can't seem to figure it out. Thanks!

ob_start();

  // start the file
  xlsBOF();
  xlsWriteLabel(0,0,"Order Number");
  xlsWriteLabel(0,1,"Month");
  xlsWriteLabel(0,2,"Name");
  xlsWriteLabel(0,3,"Address");
  xlsWriteLabel(0,4,"Address 2");
  xlsWriteLabel(0,5,"City");
  xlsWriteLabel(0,6,"State");
  xlsWriteLabel(0,7,"Zip");
  xlsWriteLabel(0,8,"Country");
  xlsWriteLabel(0,9,"Email");
  $xlsRow = 1;
  while(list($id,$fname,$lname,$email,$s_address,$s_address2,$s_city,$s_state,$s_zip,$s_country,$months_shipped)=mysql_fetch_row($result)) {
      ++$i;
            xlsWriteNumber($xlsRow,0,$id);
            xlsWriteNumber($xlsRow,1,$months_shipped+1);
            xlsWriteLabel($xlsRow,2,"$fname $lname");
            xlsWriteLabel($xlsRow,3,"$s_address");
            xlsWriteLabel($xlsRow,4,"$s_address2");
            xlsWriteLabel($xlsRow,5,"$s_city");
            xlsWriteLabel($xlsRow,6,"$s_state");
            xlsWriteLabel($xlsRow,7,"$s_zip");
            xlsWriteLabel($xlsRow,8,"$s_country");
            xlsWriteLabel($xlsRow,9,"$email");

      $xlsRow++;
      }
       xlsEOF();

$filepath="/home/nick/Dropbox/Daily-Shi开发者_开发百科pments/".date("m-d-y")."-Daily-Shipments.xls";

if (file_put_contents($filepath, ob_get_clean())) {

// Permissions for everything
chmod($filepath, 0777);


It looks like it is being opened as a protected file as it originated from the internet. I have changed my protected file settings, and everything seems to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜