odea/application/controllers/UploadController.php
2012-12-06 16:51:14 +00:00

38 lines
915 B
PHP

<?php
Class UploadController extends Zend_Controller_Action
{
protected $path;
protected $extensions;
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;
}*/
}
}