简体   繁体   中英

how to store and display images in other directory in php apache2 in laravel 3

my directory structure is like (in ubuntu)

  /var/www/mysite/application/(here is code)

i want to store my uploaded photos in

  /var/www/mysite/uploads/(a.jpg) 

should i use alias in .htacccess file for directory so that it will not expose to other users, where actually directory resides ? but in that case how to display that file in

i refer other Question they said i should use

header('Content-type: image/jpeg');
 readfile('/path/to/picture/outside/doc/root/file.jpg');

can you gus plz tell me how to store photos in above mentioned directory structure ?

It depends where is your public folder. If it is the ..../my site/ then just in the config folder set the images folder to be the uploads or use URL::to_asset to point to the specific file. could you tell me where is your public folder of Laravel?

Another - exotic - solution would be to use a "proxy" route that would return the requested image via code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM