contents of add.thtml  file are:
--------------------------------------------------------------------------------------------------------------------
***********************************************************************************
<?php echo $html->formTag('/products/add',array('enctype'=>'multipart/
form-data','method'=>'post')) ?>
<p>Please fill out the Product Informations.</p>
<table width="50%">
<tr><td><label>Product Name:</label></td>
        <td><?php echo $html->inputTag('Product/title', array('size' =>
'40')) ?></td></tr>
        <?php // echo $html->tagErrorMsg('Product/title', $title_error) ?>
<tr><td><label>Image:</label></td>
        <td><?php echo $html->fileTag('Product/image_path', array()) ?></td></
tr>
        <?php // echo $html->tagErrorMsg('Product/image_path', 'image is
required') ?>
<tr><td><label>Description:</label></td>
        <td><?php echo $html->textarea('Product/description',
array('rows'=>'10', 'cols'=>'30')) ?></td></tr>
        <?php // echo $html->tagErrorMsg('Product/description',
$description_error) ?>
<tr><td colspan='2'><?php echo $html->submitTag('add') ?></td></tr>
</table>
</form>
--------------------------------------------------------------------------------------------------------------------
***********************************************************************************
content of controller product_controller.php are:

class ProductsController extends AppController
{
  //var $scaffold;
  var $name = 'Products';
var $helpers = array('Html', 'Form' );
function index() {
        $this->Product->recursive = 0;
        $this->set('products', $this->Product->findAll());
}
function add() {
        if(empty($this->data)) {
                $this->render();
        } else {
                $this->cleanUpFields();
                                
e(move_uploaded_file(this->data['product']['image_path']);
                                                if 
(move_uploaded_file($_FILES['filename']['tmp_name'],
$uploadfile)) {
                                                                
$this->Session->setFlash('File is valid, and was successfully
uploaded.');
                                                                
$this->redirect('/products/index');
                                                                        } else {
                                                                                
        $this->Session->setFlash('There\'s issues! Maybe the file
is too big, or unacceptable mime type.');
                                                                                
        $this->redirect('/products/index');
                                                                                
}

                if($this->Product->save($this->data)) {
                        $this->Session->setFlash('The Product has been
saved');
                        $this->redirect('/products/index');
                } else {
                        $this->Session->setFlash('Please correct
errors below.');
                }
        }
}
}
----------------------------------------------------------------------------------------------------------

On Jan 25, 12:14 pm, manish <[EMAIL PROTECTED]> wrote:
> Can you tell, what is the enctype you gave for the form?
>
> On Jan 25, 11:17 am, Rgarg <[EMAIL PROTECTED]> wrote:
>
> > please help me...... its not working.
> > the value of $_FILES['filename']['tmp_name'] is not comming form my
> > add.thtml page.
> > what's the solution for this?
>
> > On Jan 24, 9:13 pm, "Novice Programmer" <[EMAIL PROTECTED]>
> > wrote:
>
> > > At the face of it, every thing looks ok.. it would be great if you dont 
> > > mind
> > > telling us the error messages you are getting.
>
> > > Thanks.
>
> > > On 1/24/08, Rgarg <[EMAIL PROTECTED]> wrote:
>
> > > > Hi
>
> > > > Please help me to upload a file. i am using this
>
> > > > if (move_uploaded_file($_FILES['filename']['tmp_name'],
> > > > $destination_path)) {
> > > >        $this->Session->setFlash('File is valid, and was successfully
> > > > uploaded.');
> > > >                $this->redirect('/products/index');
> > > > } else {
> > > > $this->Session->setFlash('There\'s issues! Maybe the file is too
> > > > big.');
> > > >        $this->redirect('/products/index');
> > > > }
>
> > > --
> > > Thanks & Regards,
> > > Novice (http://ishuonweb.wordpress.com/).
--~--~---------~--~----~------------~-------~--~----~
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