[SOLVED] uploads folder, where can i put it!
Moderator: General Moderators
uploads folder, where can i put it!
hi guys,
when you upload a file and you move it from the temp folder say to a uploads folder, does the uploads folder have to be in the same dir as the upload script?
this seems to be the case for me!
i tried putting the uploads folder under page 1 and it wont work, only works when under page 2, where the upload script is.
thanx!
site
|__ Page 1
|
|
|__ Page 2/upload script, uploads
when you upload a file and you move it from the temp folder say to a uploads folder, does the uploads folder have to be in the same dir as the upload script?
this seems to be the case for me!
i tried putting the uploads folder under page 1 and it wont work, only works when under page 2, where the upload script is.
thanx!
site
|__ Page 1
|
|
|__ Page 2/upload script, uploads
Last edited by C_Calav on Mon Jun 28, 2004 10:56 pm, edited 1 time in total.
so having it in a diff dir branch doesnt matter?
just cant get to work eliminating problems!
does it matter if i type
/Pics/
Pics/
http://www.website.com/Pics/
just cant get to work eliminating problems!
does it matter if i type
/Pics/
Pics/
http://www.website.com/Pics/
Code: Select all
<?php
move_uploaded_file($_FILES['file']['tmp_name'],
Pics/' . $_FILES['file']['name']);
echo 'File has been stored in your uploads directory.';
?>Code: Select all
move_uploaded_file($_FILES['file']['tmp_name'], '/the/full/path/to/Pics/'.$_FILES['file']['name']);ERROR:
Warning: move_uploaded_file(): open_basedir restriction in effect. File(/the/full/path/to/Pics/VVV.jpg) is not within the allowed path(s): (/var/users:/home/users:/tmp:/var/www/defaults:/usr/local/apache-custs/defaults:/usr/local/lib/php) in /var/users/modelair/modelaircraft.co.nz/htdocs/admin/insert.php on line 46
File has been stored in your uploads directory.
and heres my script...the Pics folder has full permissions
BTW it works fine when the Pics folder is in the same dir as the upload script.
Warning: move_uploaded_file(): open_basedir restriction in effect. File(/the/full/path/to/Pics/VVV.jpg) is not within the allowed path(s): (/var/users:/home/users:/tmp:/var/www/defaults:/usr/local/apache-custs/defaults:/usr/local/lib/php) in /var/users/modelair/modelaircraft.co.nz/htdocs/admin/insert.php on line 46
File has been stored in your uploads directory.
and heres my script...the Pics folder has full permissions
BTW it works fine when the Pics folder is in the same dir as the upload script.
Code: Select all
<?php
if (($_FILES['file']['size'] > 1000))
{
echo 'Uploading ' . $_FILES['file']['name'] . ' (' .
$_FILES['file']['type'] . ', ' .
ceil($_FILES['file']['size'] / 91024) . ' Kb).<br />';
if (file_exists('Pics/' . $_FILES['file']['name']))
{
echo $_FILES['file']['name'] . ' already exists. ';
echo 'Please delete the destination file and try again.';
}
else
{
move_uploaded_file($_FILES['file']['tmp_name'], '/the/full/path/to/Pics/'.$_FILES['file']['name']);
echo 'File has been stored in your uploads directory.';
}
}
?>er...your supposed to replace /the/full/path/to/Pics with your actual full path to it. As your server has open_basedir in effect Pics will have to be in one of these directories:File(/the/full/path/to/Pics/VVV.jpg) is not within the allowed path(s):
/var/users:/home/users:/tmp:/var/www/defaults:/usr/local/apache-custs/defaults:/usr/local/lib/php
Warning: move_uploaded_file(): open_basedir restriction in effect. File(/etc/httpd/htdocs/Pics/GAG.jpg) is not within the allowed path(s): (/var/users:/home/users:/tmp:/var/www/defaults:/usr/local/apache-custs/defaults:/usr/local/lib/php) in /var/users/modelair/modelaircraft.co.nz/htdocs/admin/insert.php on line 38
File has been stored in your uploads directory.
still getting a error
File has been stored in your uploads directory.
still getting a error
Looks like the host has some funky symlinking going on (stooopid open_basedir).
So try:
move_uploaded_file($_FILES['file']['tmp_name'], '/var/users/modelair/modelaircraft.co.nz/htdocs/Pics/'.$_FILES['file']['name']);
(presuming you created the Pics dir in /var/users/modelair/modelaircraft.co.nz/htdocs/)
So try:
move_uploaded_file($_FILES['file']['tmp_name'], '/var/users/modelair/modelaircraft.co.nz/htdocs/Pics/'.$_FILES['file']['name']);
(presuming you created the Pics dir in /var/users/modelair/modelaircraft.co.nz/htdocs/)