Re: Testing image upload
Hi Matteo,
Wrap move_uploaded_file and is_uploaded_file inside the controller
function moveUploadedFIle($filename, $destination) {
return move_uploaded_file($filename, $destination);
}
function moveUploadedFIle($filename, $destination) {
return is_uploaded_file($filename, $destination);
}
Then inside your testController override them.
class TestPostsController extends postsController {
protected function isUploadedFile($filename) {
return true;
}
protected function moveUploadedFile($filename, $destination) {
return true;
}
kind regards,
Leigh
On Dec 11, 5:54 am, Matteo Landi <mat...@matteolandi.net> wrote:
> bump!
>
>
>
>
>
>
>
>
>
> On Sat, Dec 3, 2011 at 8:01 PM, Matteo Landi <landima...@gmail.com> wrote:
> > Hi list,
> > what is the right way (if any) to test a controller which handles file
> > uploads? At the moment I fill $_FILES with an array containing the
> > fields expected by the controller (i.e. 'tmp_name', 'size', etc.) and
> > then invoke testAction() passing $_FILES as well, but the whole
> > mechanism fails when issuing move_uploaded_file() (is_uploaded_file()
> > with provided 'tmp_name' is actually returning false). What do you
> > suggest?
>
> > Regards,
> > Matteo
>
> > --
> >http://www.matteolandi.net/
>
> --http://www.matteolandi.net/
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home