yii - losing image when form is not valid -
i quite stuck. saving image temporary folder. when form doesn't validate on submit, why form lose image name?
heres have:
if(cuploadedfile::getinstance($model, 'product_image') !==null) { $product_image=cuploadedfile::getinstance($model,'product_image'); $f_product_image = "{$impdate}{$random6}{$product_image}"; $model->product_image = $f_product_image; if($session['image0']&&file_exists($thumb.'thumb_'.$session['image0'])){ $old_name = $session['image0']; unlink($url.$old_name); unlink($thumb.'thumb_'.$old_name); }else $session['image0']=$f_product_image; } else $model->product_image = $session['image0'];
Comments
Post a Comment