Jump to content

upload image outside of root directory

upload outside-root

  • Please log in to reply
2 replies to this topic

#1 jrowe



  • Members
  • PipPip
  • 23 posts

Posted 30 July 2012 - 03:53 PM

Is it possible to set the upload directory outside of the root directory? Was going to try making a "test" site (for learning purposes) to process images outside of the root directory so users could not directly access the images through URLs. Could someone provide an example?



thank you! :)

#2 jrowe



  • Members
  • PipPip
  • 23 posts

Posted 16 August 2012 - 03:15 PM

is this possible?

#3 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 19 February 2014 - 05:32 AM

Technically this is not possible.Grocerycrud library wont allow you to save your files outside the application. But there is a way to achieve it - you need to alter the code to allow you to set a hardbound path where u can go and upload. But this may give trouble for the library to pickback the file from the given path and render it as output - so not recomended


This scenario is again not a practical solution on server side as if its a shared server - u might not have any option  like this other then the folder / files alloted to u.

Again when u plan to display this - it will not be able to do it properly unless it is part of some web accessible folder.


There are other way you can do to achieve the same functionality without temporing the code...

1 - use callback_after_upload .. once the file is uploaded - copy / move the file from the upload path to your desired path... u will this way manage 2 save the file to your desired path. But everytime u want to display it - u have to programatically display it if the folder u uploaded is not a web accessible folder.

2 - Other way in linux system - u can achieve this even without the callback.. create a softlink of the folder u want to upload the files to into the assets/uploads folder and set the file upload path to that softlink and it should directly save the file to the desired path.


Happy GCing:)

Also tagged with one or more of these keywords: upload, outside-root

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users