Relative paths when uploading image with Symfony 1.4 on shared hosting
<p>I've had a running website on VPS which I've built using Symfony 1.4.20 but then I decided to move it to a shared hosting and the problems arised. I think I've done the essential parts since it's accesible now but when I try to upload any images via backend it shows error message as in the ss below:</p>

<p><a href="http://i.stack.imgur.com/YJ7Ce.png" rel="nofollow">Failed to create file upload directory "/../public_html/img".</a></p>

<p>img folder, which I try to upload the image into, is already created and inside the public_html folder. I also set public_html and img folders' chmod as 777.</p>

<p>When I use the url_for function it shows the correct url of images from public_html/img folder, for example: domain/img/imagename.png</p>

<p>Here's my configuration:</p>

<p>/</p>

<p>/app (Everything except web folder is here)</p>

<p>/public_html (I put everything inside the web folder into this folder)</p>

<p>My ProjectConfiguration.class.php file:</p>

<pre><code>require_once dirname(__FILE__).'/../lib/vendor/symfony-1.4.20/lib/autoload/sfCoreAutoload.class.php';
public function configureDirectories()
{

    sfConfig::set('sf_web_dir', '/../public_html');
    sfConfig::set('sf_all_images_url', '/img');

    sfConfig::set('sf_all_images_dir', sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'img');
}
</code></pre>

<p>And in my backend.php:</p>

<pre><code>require_once(dirname(__FILE__).'/../app/config/ProjectConfiguration.class.php');
</code></pre>

<p>So when I want to save any image I give the relative path like this:</p>

<pre><code>$filepathImage = sfConfig::get('sf_all_images_dir') . '/' . $filenameImage;
</code></pre>

<p>It used to work back in the day when my website is configured as default on the private server but now I'm stuck, I need to fix this as soon as possible, so please help me :) I didn't do any url rewriting. If you need further information about any part of the project I can show it. Thanks.</p>