This is my basic folder structure:
www/
index.html
img/
admin/
index.php
I want to be able to upload an image through the index.php file but save the file into the img folder.
This would normally be straight forward, however the admin part of it has a separate subdomain and the root is set to www/admin/
Is there any way to still save the file in a folder above root?
When trying to save to the directory i get the following error:
move_uploaded_file(../img/product/image.jpg) [http://php.net/function.move-uploaded-file]: failed to open stream: No such file or directory
Note: It works fine when I am using wamp locally. Its only when putting it live on a linux server.
This is your folder structure:
www/
index.html
img/
admin/
index.php
Your folder structure must be like this:
www/
index.html
img/
product/
admin/
index.php
your product
folder doesn't exist that's why you get an error like "failed to open stream: No such file or directory"
or set your code like this if you don't want another directory inside the img
folder:
move_uploaded_file(../img/image.jpg);