Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Error uploading images via admin - permission denied on Windows host

Error uploading images via admin - permission denied on Windows host

Locked

Views: 6,086

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
3 Oct 2006, 3:44 PM
#1
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Error uploading images via admin - permission denied on Windows host

I have installed and use EP with success. Recently I try to input manually the old way one by one and I found that I cannot upload pictures, I can create, and add text, but when I add pictures the error is :

PHP Warning: move_uploaded_file(C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/images/MJY00022.jpg): failed to open stream: Permission denied in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\includes\classes\upload.php on line 112 PHP Warning: move_uploaded_file(): Unable to move 'c:\temp\php53B.tmp' to 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/images/MJY00022.jpg' in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\includes\classes\upload.php on line 112

before looking at anything or versions, does any one have any quick idea on this?

3 Oct 2006, 5:00 PM
#2
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

I think it may not be a EP problem. I have no idea.
Now when I try to edit or view any product in admin, the line:

PHP Fatal error: Call to a member function on a non-object in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\includes\modules\product\collect_info.php on line 442

is on every page, and I can only see half the page, it stops loading.
And on my main page, certain product picture are squeezed or pulled out. And my banners also have problem, some images are squeezed. I have done nothing. Something is very wrong with image related files...

3 Oct 2006, 5:03 PM
#3
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

the problem is affecting ALL my pictures, if they are not in 640x480 proporation, they will be stretched out. And when I click on the thumbnails, usually the full image will show, now the thumbnails will be shown...

4 Oct 2006, 12:27 AM
#4
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

anyone know what is happening?

4 Oct 2006, 12:52 AM
#5
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

line 442 on collect_info.php seems to be pointing at these bunch of codes:

<?php $dir = @dir(DIR_FS_CATALOG_IMAGES); $dir_info[] = array('id' => '', 'text' => "Main Directory"); while ($file = $dir->read()) { if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") { $dir_info[] = array('id' => $file . '/', 'text' => $file); } } what is this? and what could be the potential problem?
4 Oct 2006, 4:06 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error uploading images via admin - permission denied on Windows host

ronwong:

move_uploaded_file(C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/images/MJY00022.jpg): failed to open stream: Permission denied

Your webserver doesn't have permission to write files to the images folder.

You're running IIS, so you need to set the security permissions on the images folder to read/write for your Internet Guest Account user.

4 Oct 2006, 4:11 AM
#7
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

thank you. Its just very strange, that all along I have been running and updating with no issue, and suddenly like this. In my admin I swear I have put the folder to write and read permission, but I will check with my hosting.

4 Oct 2006, 4:34 AM
#8
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

I have got my hosting to help me give permission to write, but its the same problem.
Now, in admin, when I click up any product, the error is immediate:

PHP Fatal error: Call to a member function on a non-object in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\includes\modules\product\collect_info.php on line 442

Then only half the page loads, up to the descriptions and Product Model. The image, weight and all the stuff below does not load. I dont have the update, cancel button, so technically I cant edit anything. Is any file corrupted? Where can I troubleshot?

4 Oct 2006, 5:05 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error uploading images via admin - permission denied on Windows host

I'll guess that your Windows host has no facility for reporting errors like Apache does, so there's no way to find out what "really" is going wrong.

Chances are it's still a problem related to permissions.

Your line 442 is likely this?while ($file = $dir->read()) {which is attempting to work with a null object built here:```
$dir = @dir(DIR_FS_CATALOG_IMAGES);

- wrong
- not set properly in your /admin/includes/configure.php file
- not readable
- not readable in a way that PHP is allowed to create a directory listing of its contents
4 Oct 2006, 10:01 AM
#12
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

I will check your list and maybe recopy via ftp the whole image folder.
Just a query. If I get fedup, can I copy a backup of all the folders in my online shop and replace what is on the server?
I do backups ocassionally copying the whole directory structure down from ftp. Will this have any impact on the sales data? I believe the transactions are in the mysql? That should replace all the system files while not modifying my live sales data.
Please enlighten.

4 Oct 2006, 11:15 AM
#13
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

DrByte:

which would suggest that your DIR_FS_CATALOG_IMAGES path is one or more of:

  • wrong
  • not set properly in your /admin/includes/configure.php file
  • not readable
  • not readable in a way that PHP is allowed to create a directory listing of its contents

I have checked point 2, which is images/, which is correct. Would you elaborate more on 'wrong' and the other 2? So that I can do some troubleshoot? Sorry, I have been mentioning this all the time, but I am really a programming nut, I am a user.

4 Oct 2006, 1:21 PM
#14
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

more info that may narrow the problem:

when I go to developer tool kit and search for any term. I have no issue when I search admin only. But catalog/admin or catalog, and the following error occurs no matter what I search for, basically it wont work:

PHP Warning: dir(C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot//images): failed to open dir: Invalid argument in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\developers_tool_kit.php on line 36 PHP Fatal error: Call to a member function on a non-object in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\developers_tool_kit.php on line 38

So seems like its related to CATALOG. What is this and where do I trouble shoot this?

4 Oct 2006, 2:19 PM
#15
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

Further testing, if I create a new category in admin, the page is blank and the only error on the page:

PHP Fatal error: Call to a member function on a non-object in C:\Program Files\Ensim\Sitedata\onlineshop\Inetpub\wwwroot\admin2\categories.php on line 616

4 Oct 2006, 6:44 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error uploading images via admin - permission denied on Windows host

please post your /admin/includes/configure.php and /includes/configure.php files without password

5 Oct 2006, 5:25 AM
#17
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

admin inlcude configure below

<?php // // +----------------------------------------------------------------------+ // |Zen Cart Open Source E-commerce | // +----------------------------------------------------------------------+ // | Copyright (c) 2004 The Zen Cart developers | // | | // | <http://www.zen-cart.com/index.php> | // | | // | Portions Copyright (c) 2003 osCommerce | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | <http://www.zen-cart.com/license/2_0.txt>. | // | If you did not receive a copy of the Zen Cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | [[email protected]](mailto:[email protected]) so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // // Define the webserver and path parameters // Main webserver: eg, <http://localhost> - should not be empty for productive servers define('HTTP_SERVER', 'http://www.onlineshop.com.sg'); // Secure webserver: eg, <https://localhost> - should not be empty for productive servers define('HTTPS_SERVER', 'https://www.onlineshop.com.sg'); // eg, <https://localhost> define('HTTP_CATALOG_SERVER', 'http://www.onlineshop.com.sg'); define('HTTPS_CATALOG_SERVER', 'https://www.onlineshop.com.sg'); // secure webserver for catalog module and/or admin areas? define('ENABLE_SSL_CATALOG', 'false'); define('ENABLE_SSL_ADMIN', 'false'); // NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes! // * DIR_WS_* = Webserver directories (virtual/URL) // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder) define('DIR_WS_ADMIN', '/admin2/'); define('DIR_WS_CATALOG', '/'); define('DIR_WS_HTTPS_ADMIN', '/admin2/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_CATALOG_IMAGES', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'images/'); define('DIR_WS_CATALOG_TEMPLATE', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/templates/'); 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', HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'includes/languages/'); define('DIR_WS_BLOCKS', DIR_WS_INCLUDES . 'blocks/'); // * DIR_FS_* = Filesystem directories (local/physical) //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/ define('DIR_FS_ADMIN', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/admin2/'); define('DIR_FS_CATALOG', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/'); 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_CATALOG_TEMPLATES', DIR_FS_CATALOG . 'includes/templates/'); define('DIR_FS_CATALOG_BLOCKS', DIR_FS_CATALOG . 'includes/blocks/'); define('DIR_FS_CATALOG_BOXES', DIR_FS_CATALOG . 'includes/boxes/'); define('DIR_FS_BACKUP', DIR_FS_ADMIN . 'backups/'); define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/'); define('DIR_FS_FILE_MANAGER_ROOT', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot'); // path to starting directory of the file manager // define our database connection define('DB_TYPE', 'mysql'); define('DB_PREFIX', ''); define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty define('DB_SERVER_USERNAME', 'xxxxx'); define('DB_SERVER_PASSWORD', 'xxxxx'); define('DB_DATABASE', 'onlineshop'); define('USE_PCONNECT', 'false'); // use persistent connections? define('STORE_SESSIONS', 'db'); // leave empty '' for default handler or set to 'db' // The next 2 "defines" are for SQL cache support. // For SQL_CACHE_METHOD, you can select from: none, database, or file // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder // ie: /path/to/your/webspace/public_html/zen/cache -- leave no trailing slash define('SQL_CACHE_METHOD', 'none'); define('DIR_FS_SQL_CACHE', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/cache'); ?>
5 Oct 2006, 5:27 AM
#18
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

include configure below

<?php // // +----------------------------------------------------------------------+ // |Zen Cart Open Source E-commerce | // +----------------------------------------------------------------------+ // | Copyright (c) 2004 The Zen Cart developers | // | | // | <http://www.zen-cart.com/index.php> | // | | // | Portions Copyright (c) 2003 osCommerce | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | <http://www.zen-cart.com/license/2_0.txt>. | // | If you did not receive a copy of the Zen Cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | [[email protected]](mailto:[email protected]) so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // // Define the webserver and path parameters // Main webserver: eg, <http://localhost> - should not be empty for productive servers define('HTTP_SERVER', 'http://www.onlineshop.com.sg'); // Secure webserver: eg, <https://localhost> - should not be empty for productive servers define('HTTPS_SERVER', 'https://www.onlineshop.com.sg'); // secure webserver for checkout procedure? define('ENABLE_SSL', 'false'); // NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes! // * DIR_WS_* = Webserver directories (virtual/URL) // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder) define('DIR_WS_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', '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_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/'); define('DIR_WS_BLOCKS', DIR_WS_INCLUDES . 'blocks/'); define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/'); define('DIR_WS_PHPBB', '/'); // * DIR_FS_* = Filesystem directories (local/physical) //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/ define('DIR_FS_CATALOG', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/'); define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS); define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/'); // define our database connection define('DB_TYPE', 'mysql'); define('DB_PREFIX', ''); define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty define('DB_SERVER_USERNAME', 'xxxxx'); define('DB_SERVER_PASSWORD', 'xxxxx'); define('DB_DATABASE', 'onlineshop'); define('USE_PCONNECT', 'false'); // use persistent connections? define('STORE_SESSIONS', 'db'); // leave empty '' for default handler or set to 'db' // The next 2 "defines" are for SQL cache support. // For SQL_CACHE_METHOD, you can select from: none, database, or file // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder // ie: /path/to/your/webspace/public_html/zen/cache -- leave no trailing slash define('SQL_CACHE_METHOD', 'none'); define('DIR_FS_SQL_CACHE', 'C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/cache'); ?>
5 Oct 2006, 5:32 AM
#19
ronwong avatar

ronwong

Zen Follower

Join Date:
Jan 2006
Posts:
223
Plugin Contributions:
0

Re: Error uploading images via admin - permission denied on Windows host

thank you for your patience. Basically, the whole site works and seems to be good, admin is good, except for categories tab, I edit a product, it gives the error and the page stops loading halfway, so it shows up to product quantity only, no model number, upload image and the rest of the page. I cannot edit or add categories, it just give error and blank page, DTK does not work for catalog, and on the actual site itself, images are stretched or squeezed, like a full length banner, is squeezed to a sidebox size, products not in 4:3 are stretched to fit 4:3, and all products does not have the blown ups full size anymore.
Because these happened, I was trying to upload a file using EP, then I deleted a category. So really dont know what went wrong. Anyway I am on ZC1.26

5 Oct 2006, 8:33 AM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Error uploading images via admin - permission denied on Windows host

Is that all ?

Personally, I'd be running, not walking, to another host.

Your upload problems are permissions-related.
Your page-draw problem on the collect_info page is permissions-related with respect to accessing the C:/Program Files/Ensim/Sitedata/onlineshop/Inetpub/wwwroot/images folder, namely using the PHP dir() function.
Your DTK problem is most likely permissions-related in with respect to accessing files, also using the PHP dir() function.

And for your image-stretch/compress problems, if you have Zen Cart set to proportionally size things, then your PHP isn't telling Zen Cart accurate information about those images in order for it to properly calculate. If you do not have them set for proportional sizing, then perhaps you have forced dimensions incorrectly either by using admin settings, or by hard-coding settings. Or else you've broken some templates somewhere and thus layout components are conflicting with each other.