Sunday, June 22, 2014

import excel file to sql server via cake php

hi all, i'm newbie. i try to import excel file to sql server via cake php. Below is my code. I used php-excel-reader.

I try in this source code in dreamweaver, it shows line 8 is a syntax error.

$destination = realpath('../../app/webroot/uploads/excel/'); 

HERE is the code: 

App::import('Vendor', 'php-excel-reader/excel_reader2'); 
class UploadsController extends RealTimeAnalysisAppController 
public function upload() 

$destination = realpath('../../app/webroot/uploads/excel/'); 
if(isset($_FILES['Upload']['XLS_File'])); 
$ext = substr($_FILES['Upload']['XLS_File'], strrpos($_FILES['Upload']['XLS_File'], '.') + 1); 
$path = $destination.'excel.'.$ext; 
move_uploaded_file($_FILES['Upload']['tmp_name'], $path); 
$data = new Spreadsheet_Excel_Reader($path, true); 
$temp = $data->dumptoarray(); 
if($temp) 

foreach ($temp as $key=>$val) 

$val['0']; 


}}

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: