On Sat, Nov 6, 2010 at 11:45 AM, Raphi <[email protected]> wrote:
> Hi there,
>
> I got a little issue loading up an image.
>
> All the validation works just fine but when it comes to moving things
> around something happens to fail.
> I use this very simple code to move the uploaded temp file:
>
> $filePath = WEBROOT_DIR . DS . 'product_img/'.$this->data['Product']
> ['img']['name'];
> move_uploaded_file($this->data['Product']['img']['tmp_name'],
> $filePath);
>
> I have a product_img folder within my webroot folder and its
> permissions are set to 777. However Cake throws the following errors:
>
> Warning (2): move_uploaded_file(webroot/product_img/testbild2.jpg)
> [function.move-uploaded-file]: failed to open stream: No such file or
> directory [APP/controllers/products_controller.php, line 49]
> Code | Context
>
> Warning (2): move_uploaded_file() [function.move-uploaded-file]:
> Unable to move '/is/htdocs/user_tmp/web44/phpqKQhWD' to 'webroot/
> product_img/testbild2.jpg' [APP/controllers/products_controller.php,
> line 49]
>
>
> I'm quite sure it's a problem with my filepath but I tried a lot and
> nothing worked here. I hope you guys will bail me out again.

Look closer at the error msg. WEBROOT_DIR is just that--the name of
the webroot dir. You want to use WWW_ROOT.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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