cakePHP File Download was not found or not readable

后端 未结 2 1151
野趣味
野趣味 2021-01-22 08:51

I\'ve been struggling now for an hour trying to fix this. I used this to download file from app/uploads/ directory. It says the directory not found or not readable.

相关标签:
2条回答
  • 2021-01-22 09:35

    Make sure you have no other model named File. If so - it apparently overwrites the cakephp's core Utility/File model.

    0 讨论(0)
  • 2021-01-22 09:52

    "It says the directory not found or not readable."

    So, you verified that the directory existed. You did not verify that it was readable to your webserver user. Check the file permissions on the directory itself, and on the files inside the directory.

    For a quick fix, you could change the permissions to 777 temporarily just to see if that fixes your problem. If it does, then you know it's just a matter of ensuring the file permissions are correct. Don't leave the permissions at 777 because that is insecure!

    Typically you'd have directories with 755 permissions, and files with 644 permissions, or something similar to that.

    UPDATE: Directory permissions are completely independent of XAMP. They're an operating-system thing. On Mac, you navigate to the file in finder, and then you can right-click and select 'get info' to view and change permissions. I don't use windows - but if you google "change file permissions windows" then heaps comes up, such as: http://www.wikihow.com/Change-File-Permissions-on-Windows-7

    And as a separate issue, reading up on file permissions management would be a good idea. You'll definitely need to understand how it works as you move forward building Cake sites, or any websites for that matter.

    0 讨论(0)
提交回复
热议问题