How to upload image(photo), and path entry in database with update functionality

View : Model : Controller : I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not covering image attribute related functionality) View :  _form.php file: ..//form options array…’htmlOptions’ => array( ‘enctype’ => ‘multipart/form-data’, ),…..//Other elements….<div class=”row”> <?php… Continue reading How to upload image(photo), and path entry in database with update functionality

How to upload image(photo), and path entry in database with update functionality

View : Model : Controller : I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not covering image attribute related functionality) View :  _form.php file: ..//form options array…’htmlOptions’ => array( ‘enctype’ => ‘multipart/form-data’, ),…..//Other elements….<div class=”row”> <?php… Continue reading How to upload image(photo), and path entry in database with update functionality

yii, handling image uploads

In Model file function rules() : <?phparray(‘product_image_1, product_image_2, product_image_3’, ‘file’, ‘types’=>’jpg, gif, png’, ‘allowEmpty’=>true),?> In View file set form like this : <div class=”form”><?php $form=$this->beginWidget(‘CActiveForm’, array( ‘id’=>’products-form’, ‘enableAjaxValidation’=>false, ‘htmlOptions’=>array(‘enctype’ => ‘multipart/form-data’))); ?> <p class=”note”>Fields with <span class=”required”>*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class=”row”> <?php echo $form->labelEx($model,’product_name’); ?> <?php echo $form->textField($model,’product_name’,array(‘size’=>60,’maxlength’=>255)); ?> <?php echo… Continue reading yii, handling image uploads