Reputation:
i want to give file path out of the webroot, how to give it?
$uploads_dir = WWW_ROOT .'/uploads';
$tmp_name = $this->data["Image"]["filedata"]["tmp_name"];
$name = $this->data["Image"]["filedata"]["name"];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
Upvotes: 1
Views: 12998
Reputation: 4411
You need another constant. Cake has a few globally defined constants you can use, see the documentation here.
In you case you want to save images in a directory outside the webroot directory (not sure if that's wise, though), so you should use APP
instead of WWW_ROOT
as the former holds the path to the directory you're application is in.
Upvotes: 1