ILYAS415 Posted September 20, 2013 Share Posted September 20, 2013 Hi guys, Basically I have a PHP script which uploads images and makes an SQL query. The script works perfectly, and the images are uploaded into a new directory created by the script. However, when I try to view the file directly though the browser, I get a 404 Page not found error. This is the same issue as when I try to link to the image with an img src tag. I know that the image exists where it does because I can see the file and download it from my file manager. I have attached screenshots showing my predicament Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/282329-uploaded-images-appear-broken/ Share on other sites More sharing options...
ILYAS415 Posted September 20, 2013 Author Share Posted September 20, 2013 Found out that my directory permissions were a bit weird. The directory was not executable or readable apparently. This is the function that the script uses to create the directory: mkdir("$desired_dir", 0700); My question is simply, how can I make it so that when the directory is created, the permissions are already there so that other pages on my host can view the directory and its files? Quote Link to comment https://forums.phpfreaks.com/topic/282329-uploaded-images-appear-broken/#findComment-1450494 Share on other sites More sharing options...
Solution DFulg Posted September 21, 2013 Solution Share Posted September 21, 2013 mkdir("path/to/dir", 0755); Quote Link to comment https://forums.phpfreaks.com/topic/282329-uploaded-images-appear-broken/#findComment-1450523 Share on other sites More sharing options...
ILYAS415 Posted September 21, 2013 Author Share Posted September 21, 2013 Thanks, it works perfectly now! Quote Link to comment https://forums.phpfreaks.com/topic/282329-uploaded-images-appear-broken/#findComment-1450553 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.