how to upload an image for model. It works for me with some changes.
But also if can I upload images which has no related model->fieldname. I mean product has many images, which are just uploaded in its directory, but they have no related database table. Class CUploadedFile used in this article works with model.
I remember about native php move_uploaded_file function, but I suppose that it is much better to use yii methods.
Also using move_uploaded_file I have to track Slashes in case OS is windows( say if developer works under windows ).
yii methods do this automaticcaly ? Please give reference to example how to do this.
$src_filename= $_FILES['Good']['tmp_name']['img_thumb'];
echo '<pre>$src_filename::'.print_r($src_filename,true).'<pre>'; // I saw valid file path
if (file_exists($src_filename)) {
echo '<pre>$src_filenameEXISTS::'.print_r($src_filename,true).'<pre>'; // it shoes me that file exists!
}
$uploadedFile = CUploadedFile::getInstanceByName($src_filename);
echo '<pre>111$uploadedFile::'.print_r($uploadedFile,true).'<pre>'; // But CUploadedFile object is empty !