I want to upload an image file . The file must not save in the
database it shoud be saved in the ..\webroot\img\.. folder. Only the
path of the image is to be stored in the database.

In controller file Coding is as follows

class FilesController extends AppController
{
    function add()
    {
                $root = $this->data['File']['imgpath'];
                if(!empty($this->data))
                {
                        if 
(!move_uploaded_file($_FILES['data[File][imgpath]']['tmp_name'],
@$fileName))
                        {
                                echo  "Cannot move file to temporary 
directory.";
                        }
                        else
                        {
                                echo "No Error";
                        }
                }
    }

}

and in add.thtml

<form action="/gadgets/files/add/" enctype="multipart/form-data"
method="post">

    <?php echo $html->file('File/imgpath'); ?>
    <?php echo $html->submit('Upload'); ?>

 </form>

but it is showing error like this

Notice: Undefined index: data[File][imgpath] in C:\www\gadgets\app
\controllers\files_controller.php on line 13

Cannot move file to temporary directory.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to