0

I am getting error The filename C:\xampp\tmp\php308F.tmp is not readable. How to resolve this issue? . why this error is coming?. App::import('Vendor','excel_reader2');

public function upload(){
if($this->request->is('post')){
$data = new Spreadsheet_Excel_Reader($_FILES['fileexcel']['tmp_name']);
$row_data = $data->rowcount($sheet_index=0);

$row = 0;
$gagal = 0;

for ($i=2; $i<=$row_data; $i++)
{
  $data1 = $data->val($i,1); 
  $data2 = $data->val($i,2);
  $data3 = $data->val($i,3);
  $data4 = $data->val($i,4);
  $data5 = $data->val($i,5);
  $data6 = '0';
  $data7 = '0'; 
  $data8 = '0';
  $data9 = '0';   

$res=$this->Item->find('all', array(
        'conditions' => array('Item.item_name' => $data1)));
if(count($res) == '0'){
     $rs                                           = $this->Item->find('first', array(
                'fields' => array(
                    'Max(Item.no) as no'
                )
            ));
            $max                                          = $rs['0']['no'];
            $maxnumber                                    = $max + 1;
           $barcode                                  = rand('1111111', '9999999') . str_pad($maxnumber, 5, "0", STR_PAD_LEFT);
$obj= new GetDate();
 $date_enter=$obj->getdate();

$this->Item->query("Insert into item (item_name,item_brand,item_price,item_tax,item_quantity,date_enter,item_barcode,BLR,MUM,WEB,EXB,no) values('$data1','$data2','$data3','$data4','$data5','$date_enter','$barcode','$data6','$data7','$data8','$data9','$maxnumber')");

}
}
$this->redirect(array('Controller' => 'Item' , 'action' => 'index'));
}
}
3
  • can you show us the code?? Commented Mar 6, 2015 at 5:30
  • Without seeing the code, seems like a file permissions problem. Commented Mar 6, 2015 at 5:33
  • why i am getting an error . Commented Mar 6, 2015 at 5:42

1 Answer 1

1

What is your file extension? is this xls or xlsx. Check if these extensions are supported by class you are using to read excel file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.