Frage

I'm using GroceryCRUD to act as a front end for a database containing news releases. Secretaries can go in and add/edit/delete news releases in the database easily now. Only qualified users are able to access the application root via an .htaccess password. The problem with this is that GroceryCRUD uploads assets such as photos are uploaded to the directory /www/approot/assets/uploads/ which is password protected since /approot/ is protected.

My ideal solution would be to set an upload directory outside of the application root which is where I'm running into trouble. By default this is how GroceryCRUD handles uploads:

$this->grocery_crud->set_field_upload('photo1','assets/uploads/');

I've tried changing it to something like this:

$this->grocery_crud->set_field_upload('photo1','/public/assets/uploads/');

I was hoping this / would make the path start from the document root instead of the application root, but it throws this error:

PHP Fatal error:  Uncaught exception 'Exception' with message 'It 
seems that the folder "/Users/myusername/www/approot//public/assets/uploads/" 
for the field name "photo1" doesn't exists.

This seems to suggest that CI or GroceryCRUD just takes the second argument in set_upload field and just concatenates it onto the end of the site URL that is defined. Is there any way around this that doesn't involve creating a user login system?

War es hilfreich?

Lösung 2

I ended up implementing a login system outlined in this tutorial:

http://net.tutsplus.com/tutorials/php/easy-authentication-with-codeigniter/

It was quite simple to set up and suits my needs. I found ways to give access to the directory using httpd.conf directives but I feel like this was a more viable solution since I don't have direct access to server configuration files.

Maybe in the future GroceryCRUD will allow placement of uploads outside the application folder.

Andere Tipps

Try using relative path.

$this->grocery_crud->set_field_upload('photo1','../assets/uploads/');

.. -> Go up one directory

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top