Forget the helpers
create a form upload element on your form
<form enctype="multipart/form-data">
<input type="file" name="myfile" id="myfile" />
</form>
in your controller do this:
if( $this->Request->isPost() ) { //see if a form has posted.
//echo '<pre>' . print_r($_FILES, 1) . '</pre>'; exit(); //uncomment this line to have a look at the $_FILES array
if( file_exists( $_FILES['myfile']['tmp_name'] ) ) { //check to make sure the file exists.
move_uploaded_file( $_FILES['myfile']['tmp_name'], $uploads_dir.'/'.$_FILES['myfile']['name'] ); //do something with the file
}
}
Just an added note. On unix systems checked your php.ini to see where the tmp directory is. Most systems specify /tmp . Make sure it is writable by everyone (i.e. chmod 777 /tmp )
-- Pogeybait
1 to 2 of 2