Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

move_uploaded_file() problems


Recommended Posts

Dear All,


seems be I have a problems on my server, after some searches i don't find any solutions, so i open a thread here.

when I try to insert a new product, the image is not been uploaded:

Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/var/www/vhosts/mydomain.com/httpdocs/catalog/images/6ED5918B-DE55-9CBA-6A12634A00A02AE4.jpg) is not within the allowed path(s): (/var/www/vhosts/mydomain.com/httpdocs:/tmp) in /mnt/wwwdata/www/vhosts/mydomain.com/httpdocs/catalog/admin/includes/classes/upload.php  on line 89


I'm sure 100% images directory have the full right permission (chmod 777)

php safe mode is off and i cannot understand why basedir restrisction is effecting on directory present in the allowed path.


so i print out the move command:

move_uploaded_file(/tmp/phpNx2gxE, /var/www/vhosts/mydomain.com/httpdocs/catalog/images/6ED5918B-DE55-9CBA-6A12634A00A02AE4.jpg) 


I see tmp is also in the allowed path, but if i go to search the temporany file called phpNx2gxE i cannot found in the directory.


The server is a red hat with plesk9


I'm glad if anyone can help me.

best regards


Link to comment
Share on other sites

There are 835 results for this


site:www.oscommerce.com/forums open_basedir restriction in effect


on google



Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile


Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.


For links mentioned in old answers that are no longer here follow this link Useful Threads.


If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

There are 835 results for this


site:www.oscommerce.com/forums open_basedir restriction in effect


on google




Hi geoffreywalton,


thanks for answering, Yes I know and before opening this thread I readed a big amount of these. most problems are by open_basedir is not included in the php config, or permission problem, but in my case /tmp is included in basedir and i have permission to write in (for be sure i just writed a small php script for uploading a file, and works).


I just finish ideas...



Link to comment
Share on other sites

Other informations:



 define('HTTP_SERVER', 'http://www.mydomain.com');
 define('HTTP_CATALOG_SERVER', 'http://wwww.mydomain.com');
 define('HTTPS_CATALOG_SERVER', 'https://wwww.mydomain.com');
 define('ENABLE_SSL_CATALOG', true);
 define('DIR_FS_DOCUMENT_ROOT', '/var/www/vhosts/mydomain.com/httpdocs/catalog/');
 define('DIR_WS_ADMIN', '/catalog/admin/');
 define('DIR_FS_ADMIN', '/var/www/vhosts/mydomain.com/httpdocs/catalog/admin/');
 define('DIR_WS_CATALOG', '/catalog/');
 define('DIR_FS_CATALOG', '/var/www/vhosts/mydomain.com/httpdocs/catalog/');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
 define('DIR_WS_CATALOG_LANGUAGES', DIR_WS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_LANGUAGES', DIR_FS_CATALOG . 'includes/languages/');
 define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
 define('DIR_FS_CATALOG_MODULES', DIR_FS_CATALOG . 'includes/modules/');
 define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/');

 define('DB_SERVER', 'localhost');
 define('DB_SERVER_USERNAME', 'user');
 define('DB_SERVER_PASSWORD', 'pwd');
 define('DB_DATABASE', 'oscommerce');
 define('USE_PCONNECT', 'false');
 define('STORE_SESSIONS', 'mysql');


I tried to disable by modify my conf/httpd.include

<Directory /home/www/vhosts/mydomain.com/httpdocs>
php_admin_value open_basedir none

but still don't working!


so i just writed a script for check if I'm able to upload:

ini_set('display_errors', '1');;

echo '
<form enctype="multipart/form-data" action="test.php?upd=1" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />

if(isset($_GET['upd']) && $_GET['upd']==1){


$target_path = "./";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
   echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
   " has been uploaded";
} else{
   echo "There was an error uploading the file, please try again!";



and this is working well!

as you can see I don't use an absolute path but a relative...

maybe can help...

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...