I am using Zend Framework, and am creating a image upload for users. So, I decided to split the users images by having a folder per user in an example directory such as /var/www/upload/user and I am planning to use PHP mkdir to create a directory for each user. While the apache public data directory is at: /var/www/domain.com/public_html. So, I am not sure how am I supposed to proceed. Because the images are not in the public_html file, how will I link the images and display it on the website? What is the solution to this? or is my setup flawed?
I am using Zend Framework, and am creating a image upload for users. So,
Share
If you store the images outside the public folder, then you probably need to create an controller/action that accepts info that identifies the image and then sends it back to the browser – complete with correct mime headers – via
readfile().In some circumstances, this makes sense: if these resources need to be restricted based upon some Auth/Acl criteria, for example. If the images uploaded by user X are not public to all users/visitors, but private to user X (or some other set of users/visitors you identify), then this approach applies.
But if these image resources are public to all, then running access to them through the entire MVC dispatch cycle seems like a lot of overhead.