file upload

This commit is contained in:
venbatechnologies@gmail.com 2018-06-15 17:04:34 +05:30
parent 21ddba9de4
commit 7828743022
4 changed files with 88 additions and 36 deletions

10
application/controllers/emergencypurchaseorder.php Executable file → Normal file
View File

@ -2,7 +2,7 @@
require APPPATH . '/libraries/BaseController.php';
/**
/**
* Class : purchaseorder (PurchaseorderController)
* User Class to control all user related operations.
* @author : VenbaMail Mali
@ -224,7 +224,7 @@ class emergencypurchaseorder extends BaseController
/*----------------------------------special po file upload service----------------------------------*/
function add($pathname)
{
echo "add files";
// echo "add files";
// die();
//echo $pathname; die();
@ -236,13 +236,13 @@ function add($pathname)
$config['allowed_types'] = '*';
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
$config['file_name'] = $_FILES[$pathname]['name'];
echo "if";
// echo "if";
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload($pathname))
{
echo "uploadif";
// echo "uploadif";
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
@ -254,7 +254,7 @@ function add($pathname)
}
else
{
echo "else";
// echo "else";
$picture = '';
}

View File

@ -8,7 +8,7 @@ require APPPATH . '/third_party/mpdf/mpdf.php';
* Class : purchaseorder (PurchaseorderController)
* User Class to control all user related operations.
* @author : Venba InfoTech
* @version : 1.1
* @version : 1.1
* @since : 09/06 Feb 2017
*/
class purchaseorder extends BaseController
@ -4165,29 +4165,39 @@ function addloadfile()
$igr= $this->input->post('igr');
$new_file_name =$_FILES['file']['name'];
//echo $new_file_name;die;
if(!empty($new_file_name))
$file = $this->purchaseorder_model->getfies($pono);
$fcount=0;
foreach ($file as $value)
{
$lastfile = $value->FilePath;
if($lastfile == $new_file_name)
{
$fcount++;
echo 'File name already Exist';
}
}
if($fcount == 0)
{
$Picture = $this->adfile();
$filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture);
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
}
else
{
$Picture ='';
}
//echo $Picture;die;
$filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture);
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
if($uploadfile > 0){
if($uploadfile > 0){
echo "file updated successfully!";
}
else{
echo "file not updated!";
}
}
function adfile()

46
application/controllers/servicepurchaseorder.php Executable file → Normal file
View File

@ -666,26 +666,52 @@ function uploadfile()
$new_file_name =$_FILES['file']['name'];
//echo $new_file_name;die;
if(!empty($new_file_name))
// if(!empty($new_file_name))
// {
// $Picture = $this->adfile();
// }
// else
// {
// $Picture ='';
// }
//echo $Picture;die;
$file = $this->purchaseorder_model->getfies($pono);
$fcount=0;
foreach ($file as $value)
{
$lastfile = $value->FilePath;
if($lastfile == $new_file_name)
{
$fcount++;
}
}
$upfile='';
if($fcount == 0)
{
$Picture = $this->adfile();
$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
$upfile = $this->purchaseorder_model->insertfile($filelist);
}
else
{
$Picture ='';
}
//echo $Picture;die;
$filelist =array('PONO'=>$pono,'FilePath'=>$Picture);
$uploadfile = $this->purchaseorder_model->insertfile($filelist);
if($uploadfile > 0){
if($upfile > 0){
echo "file updated successfully!";
}
else{
echo "file not updated!";
echo "File name already Exist";
}
}

22
application/models/purchaseorder_model.php Executable file → Normal file
View File

@ -23,7 +23,25 @@ class purchaseorder_model extends CI_Model
/*-----------may25-------------------*/
/*------------jun15------------------*/
function getfies($pono)
{
$this->db->select('*');
$this->db->from('T_PurchaseOrder_BillUpload bill');
$this->db->where('PONO',$pono);
$query = $this->db->get();
return $query->result();
}
/*-----------jun15-------------------*/
function updateMatStock($itemNo,
@ -38,9 +56,7 @@ class purchaseorder_model extends CI_Model
return $r;
}
/*-----------may25-------------------*/
/*------------------------------*/
function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){