Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

File Is Not Being Uploaded

$
0
0
Hello there,
I am using following method to upload and convert the pdf file using image magic. The create method is working but the image is not being uploaded in the respective directory.

public function actionCreate()
{
$model=new Alerts;

// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);

if(isset($_POST['Alerts']))
{
$model->attributes=$_POST['Alerts'];
$model->infoFile=CUploadedFile::getInstance($model,'infoFile');
$pdf_file = $model->infoFile->name;
$save_to = $model->getUploadPath()."sample.jpg";
if($model->save()){
// exec('convert $model->infoFile->name -colorspace RGB $model->getUploadPath().$image',$output,$return_var);
exec('convert "'.$pdf_file.'" -colorspace RGB -resize 800 "'.$save_to.'"', $output, $return_var);
// Yii::log($model->infoFile,'trace','application');
// Yii::log($model->getUploadPath(),'info');
// $model->infoFile->saveAs($model->getUploadPath().$model->infoFile->name);

}
$this->redirect(array('view','id'=>$model->id));
}

$this->render('create',array(
'model'=>$model,
));
}



Could you please suggest what could be the issue.

I can assure that webserver has write permission to $model->getUploadPath() which is Yii::getPathofAlias('webroot').'/uploads/'; and Image Magic is properly installed and configured in the webserver

Viewing all articles
Browse latest Browse all 18717

Trending Articles