0

Hey there, I'm using the tutorial at http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp to try to get myself up and running with the ability to upload images.

Now, I'm very new, and really haven't a clue so this is probably the most stupid question in the world but I don't know whats going on.

Basically I follow the tutorial as best I can but when I load the page which is supposed to have the input for the image I get the rest of the form but then get 2 errors: Method FormHelper::labelTag does not exist and Method HtmlHelper::file does not exist

I've searched but only got more confused. There is something I'm meant to include that i've missed isn't there?

confused...

1
  • 1
    You need to post you view code here Commented May 13, 2011 at 11:54

1 Answer 1

1

I assume you've put the uploadFiles function in to your APP/app_controller.php

You would do something like this in your add action, for instance:

$fileData = $this->uploadFiles('img/uploads', $this->data['File']); print_r($fileData); 

What version of Cake are you using? That tutorial is quite old, and whilst the upload functionality still works fine, the labelTag and File methods are now deprecated (as of 1.3 I think). you should use:

echo $this->Form->label('image', 'Image'); echo $this->Form->file('File.image'); 

instead, and you should be good to go.

edit You can also just use echo $this->Form->input('File.range_image', array('type'=>'file'));

as if I recall, that's the preferred way ~

Sign up to request clarification or add additional context in comments.

1 Comment

You are brilliant. And you're my new best friend. Ta :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.