Marmik Patel
Marmik Patel

Reputation: 192

get data from locked file php

require_once 'Classes/PHPExcel.php';
require_once 'Classes/PHPExcel/IOFactory.php';
// read in the existing file
$objPHPExcel = PHPExcel_IOFactory::load("filename.xls");

Currently I am using PHPExcel library for importing excel file to database but when file is updated and saved, the file goes into locked state, after locked status when I try to import file then file is uploaded successfully but the file is blank. I don't get any data in uploaded file.

Upvotes: 1

Views: 99

Answers (1)

zbee
zbee

Reputation: 948

If you need to unlock the file before accessing it, you can do so with flock and the LOCK_UN flag:

$file = fopen('filename.xls', 'r');
flock($file, LOCK_UN);

Upvotes: 1

Related Questions