Media view keeps throwing up a 404 because of the following code:
if (is_dir($path)) {
$path = $path . $id;
} else {
$path = APP . $path . $id;
}
if (!file_exists($path)) {
header('Content-Type: text/html');
$this->cakeError('error404');
}
Here are my params, btw:
Array
(
[id] => test.jpg
[name] => test.jpg
[download] => 1
[extension] => jpg
[path] => files/test/
)
That path is under APP, not WWW_ROOT, as it should be.
What's happening is that is_dir() can take a relative path and so is
checking relative tp APP and returning true. However, file_exists()
must have an absolute path.
When I changed my code to:
'path' => APP.$result['ItemFile']['directory'].DS
Everything worked.
I didn't see anything on bugtrac. Shouldn't this problem be cropping
up for everybody that uses the recommended relative-to-app path?!?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---