In my cake view, I have the following form:
<form enctype="multipart/form-data" action="<?php echo $this->base; ?>/reviews/upload/" method="post" target="_blank">
<input type="file" id="file" name="file" />
<input type="submit" />
</form>
In the ReviewsController, in the upload() method there is:
public function upload() {
var_dump($this->request->data);
}
but it's always empty! I already tried "this->request", "this->data" but it's always empty. What am I doing wrong?
Try doing it cake way,
echo $this->Form->create("Review", array("action" => "upload", "type" => "file"));
echo $this->Form->input("my-file", array("type" => "file"));
echo $this->Form->end();
In your reviews controller
public function upload() {
debug($this->request->data);
}
Using debug over var_dump and print_r as advantage that debug can be turned off in production mode application wide by setting lowering the debug level to 0 in core.php
Try changing the name of the input to somethinge else then file. Had problems with that before!