How can I access my php file from javascript in my directory structure? <p>I have the following directory structure in my PHP project (framework: <a href="https://github.com/panique/mini" rel="nofollow">https://github.com/panique/mini</a>)</p> <pre><code>application --controller ----album.php --libs ----s3demo.php --model public --css --img --js ----application.js </code></pre> <p>In the application.js (inside js folder) I have the following code</p> <pre><code> signature: { endpoint: "s3demo.php" }, </code></pre> <p>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.</p> <p>s3demo.php includes access codes to my Amazon S3 account so I want to have it outside my public folder.</p> <p>Any suggestion?</p> <p>Edit</p> <p>After I read the documentation (again) I changed the javascript to</p> <pre><code>signature: { endpoint: url + "/album/uploadImage" }, </code></pre> <p>And created a new function in album.php</p> <pre><code>public function uploadImage() { return APP . '/libs/s3demo.php'; } </code></pre> <p>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.</p>