Articles Posted in the " Yii File " Category

  • CHtml FileField

    CHtml FileField

    Using CHtml class we are creating fileField in yii framework. This post will help you to understand about how to upload file in different method, how to get and save the uploaded file in […]


  • Yii Zip Format

    Yii Zip Format

    In this article, I explained about “How to handle zip files” in yii framework. I used this code to my project for handling the zip files. Here i added source code to create, Extract, […]


  • CSV File To DB In Yii

    CSV File To DB In Yii

    CSV File Upload Read CSV In Controller CSV File Upload Using the below code i created the form “importcsvform.php”. importcsvform <div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'csv-form', 'enableAjaxValidation'=>false, 'htmlOptions'=>array('enctype' => 'multipart/form-data'), )); ?> <?php //echo […]


  • Yii CMultiFileupload

    Yii CMultiFileupload

    Properties CMultifile In View CMultifile In controller Model Validation CMultiFileUpload widget function Maximum File Size Validation On Before Upload DONT FORGET multipart/form-data <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'files-form', 'htmlOptions'=>array('enctype' => 'multipart/form-data'), )); ?> Properties CMultiFileUpload generates […]


  • Yii Hint For Files Handling

    Yii Hint For Files Handling

    This post will help you to learn “how to delete files in yii framework”. I deleted singele file and all files from directory. Delete All Files Inside Directory php glob() method used to read […]


  • Delete zip file in yii

    Delete zip file in yii

    Delete Zip Files Using PHP Here i added this code to delete the zip files inside the folder of yii framework. SourceCode: public function actionDeletefile($id,$docid) { $error=''; $filepath=Yii::app()->basePath.'/files/'.$zipfilename.".zip"; $zip = new ZipArchive; if ($zip->open($filepath) […]


  • Download Zip files in yii

    Download Zip files in yii

    Download Zip Files Using Yii Here i added the code to download the Zip files in yii folder. SourceCode: public function downloadfinal($docid,$docname) { $filename=Dirdetails"filename.zip"; if(file_exists($filename)){ $path_parts = pathinfo($filename); $ext = strtolower($path_parts["extension"]); switch ($ext) { […]


  • Create zip file in yii

    Create zip file in yii

    Create Zip Files Using PHP I added the source code to create a zip file in yii. public function actionCreatefile($filename,$filelist) { $zip=new ZipArchive(); $destination=DIRDetails."/filename.zip"; if($zip->open($destination,ZIPARCHIVE::CREATE) !== true) { return false; } foreach($filelist as $thefile) […]


  • Extract zip files in yii

    Extract zip files in yii

    Extract Zip Files Using Yii I added the source code to extract the zip files using yii SourceCode: public function actionExtractfile($filename) { $filename='filename'; $zipfile=DirDetails."/filename.zip"; $zip = zip_open($zipfile); $extract=DirDetails."/newfolder"; if ($zip) { if(!is_dir($extract)) mkdir($extract); while […]


  • Update Zip files in yii

    Update Zip files in yii

    Update Zip Files Using PHP I added the source code to add new file into existing zip files. SourceCode: public function actionUpdatezip($zipfilename,$filelist){ $destination=Yii::app()->basePath.'/files/'.$zipfilename.".zip"; $zip=new ZipArchive(); if(!$zip->open($destination)) { return false; } if($filelist) { foreach($filelist as […]