Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1) I can only read one file in one time , but what i need is it can read all the files inside the folder.when the admin saving the new xls file it can read it and display at the browser.

thanks
Posted

1 solution

I had found the solution.

.
.
.

$path = "..."; ///the folder path
		$theFilePath = "";		
		
		$theFileName = glob ($path . "*.xls");
		
		
		//Read more than one file here
		for($j = 0; $j< count($theFileName); $j++) {

		$theFilePath = $theFileName[$j];
		
		$excel = new Spreadsheet_Excel_Reader();
		$excel->setOutputEncoding('CP1251');
		$excel->setUTFEncoder('mb_convert_encoding');
		error_reporting(E_ALL ^ E_NOTICE);			
			
			//echo $theFileName[$j];; 
			
			echo "<br />";
			echo $theFilePath; 
			echo "<br />";
			 

			
			$excel->read($theFilePath);

                          .
                          .
                          .// Do what u want display here

                       }


while putting the path inside for loop, it can loop through all file inside the folder
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900