Bijesh Shrestha
Bijesh Shrestha

Reputation: 371

could not get the path on live server symfony 2

I have write a php code that upload the image to web/uploads/slider which i get through

$dir = $this->container->getParameter('assetic.write_to') . '\uploads\slider';

In my local server(windows apache) it works fine and upload as expected but the problem comes when i used it in live server it creates a folder name 'web\uploads\slider' in a project folder and upload a file in it

Upvotes: 0

Views: 80

Answers (1)

Michael Sivolobov
Michael Sivolobov

Reputation: 13240

You need to use forward slashes:

$dir = $this->container->getParameter('assetic.write_to') . '/uploads/slider';

Backslashes only work on Windows OS but forward slashes work on any OS (including Windows).

Upvotes: 2

Related Questions