48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
|
<?php
|
||
|
Class UploadController extends Zend_Controller_Action
|
||
|
{
|
||
|
protected $path;
|
||
|
protected $extensions;
|
||
|
|
||
|
public function init()
|
||
|
{
|
||
|
/*$config = Zend_Registrey::get('configuration');
|
||
|
$path = realpath($config->path->data).'/clients';
|
||
|
$this->path = $path;
|
||
|
$this->extensions = array('.csv');
|
||
|
|
||
|
if(!file_exists($path)) mkdir($path);*/
|
||
|
}
|
||
|
|
||
|
public function upload()
|
||
|
{
|
||
|
$this->_helper->layout()->disableLayout();
|
||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
|
||
|
if(!empty($_FILES) and count($_FILES) == 1)
|
||
|
{
|
||
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
||
|
$extension = strrchr($_FILES['fichier']['name'], '.');
|
||
|
if(in_array($extension, $this->extensions)) {
|
||
|
if (move_uploaded_file($tmp_name, $path.'/'.$tmp_name.'.'.$extension))
|
||
|
return ($tmp_name);
|
||
|
}
|
||
|
}
|
||
|
return (false);
|
||
|
}
|
||
|
|
||
|
public function arborescanceAction()
|
||
|
{
|
||
|
$this->_helper->layout()->disableLayout();
|
||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||
|
$url = implode('/', $this->getRequest()->getParams());
|
||
|
echo $url;
|
||
|
//$file = $this->upload();
|
||
|
/*if($file)
|
||
|
{
|
||
|
$csv = fgetcsv($file);
|
||
|
$csv = str_replace(';', ',', $csv);
|
||
|
echo $csv;
|
||
|
}*/
|
||
|
}
|
||
|
}
|