This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 1.50 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function do_upload() {
  2.  
  3.     $this->makeDir();
  4.  
  5.     $labref = $this->uri->segment(3);
  6.     $filename = 'xyz/'. date('Y').'/'.date('M').'/'. $labref .'/' . $labref . '.xlsx';
  7.     if (file_exists($filename)) {
  8.         $data['labref'] = $this->uri->segment(3);
  9.         $data['settings_view'] = 'analyst_file_present_v';
  10.         $this->base_params($data);
  11.     } else {
  12.  
  13.         $config['upload_path'] = 'xyz/'. date('Y').'/'.date('M').'/'. $labref  ;
  14.         $config['allowed_types'] = 'xls|xlsx';
  15.         $this->load->library('upload', $config);
  16.         $data=  $this->upload->data();
  17.         if ($data['file_name']=="$labref.'.xlsx'") {                
  18.           $this->SaveFileDetails();
  19.         $this->success();
  20.         }else{            
  21.          $filename = 'xyz/'.date('Y').'/'.date('M').'/'. $labref.'/'.$labref.'xlsx'  ;
  22.            unlink($filename);
  23.            echo 'You have uploaded a wrong file';
  24.         }
  25.  
  26.         if (!$this->upload->do_upload('worksheet')) {
  27.             $data['labref'] = $this->uri->segment(3);
  28.             $data['error'] = $this->upload->display_errors();
  29.  
  30.             $data['settings_view'] = 'upload_analyst_v';
  31.             $this->base_params($data);
  32.         }
  33.     }
  34. }
  35.        
  36. if ($data['file_name']=="$labref.'.xlsx'") {                
  37.                                      ^-----^---
  38.        
  39. if ($data['file_name']== $labref .'.xlsx') {
  40.        
  41. $filename = 'xyz/'.date('Y').'/'.date('M').'/'. $labref.'/'.$labref.'xlsx'  ;
  42.        
  43. $filename = 'xyz/'.date('Y').'/'.date('M').'/'. $labref.'/' . $data['file_name'];
clone this paste RAW Paste Data