I have the following directory structure in my PHP project (framework: https://github.com/panique/mini)
application
--controller
----album.php
--libs
----s3demo.php
--model
public
--css
--img
--js
----application.js
In the application.js (inside js folder) I have the following code
signature: {
endpoint: "s3demo.php"
},
How can I access the s3demo.php (in the libs folder) from my javascript (application.js in the js folder)? I have tested with relative path ../../application/libs/s3demo.php and even tried to go through my controller album.php but cant access the file.
s3demo.php includes access codes to my Amazon S3 account so I want to have it outside my public folder.
Any suggestion?
Edit
After I read the documentation (again) I changed the javascript to
signature: {
endpoint: url + "/album/uploadImage"
},
And created a new function in album.php
public function uploadImage() {
return APP . '/libs/s3demo.php';
}
But this does not work either. I think I understand routes. The javascript calls the function in album.php and the funtion return the s3demo.php. But it feels wrong to return a php-file.