Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Once Uploaded images won't download- 'permission denied'


maz

Recommended Posts

Hi

 

Uploading product images via the 'products' in Admin has posed no probelm. The Oscommerc site is working perfectly too. As a precaution I downloaded the complete site from my server and found that NONE of the product images were downloaded. Even changing CHMOD for folders or individual images didnt make a difference. Using WS_FTP Pro to download, the mesage I get for every product image is 'Error 550 PERMISSION DENIED' .

 

All other images are fine and will download from all folders on my server outside the oscommerce catalog folder. Only the 'PRODUCT images' uploaded via the admin panel have this problem. The /catalog/images folder is CHMOD 777

 

When looking at the list of MY UPLOADED images they all show

chmod -rw-- -- --

Compared to the original oscommerce gifs in the various catalog/images folders, they all show chmod -rw-r--r-- and I CAN download them.

 

Even if I change chmod from -rw-- -- -- to -rw-r--r-- for each of my own product images, I still get 550 Permission denied.

 

Just cant figure out why I can't download them. All my images are either jpeg or gif and only around 10k or so.

Does OsCommerce do anything to the permissions when uploading products?

 

Any help would be appreciated.

 

Best Regards

 

Mazhar.

Link to comment
Share on other sites

If you chmod all of the files in your images folder on your server to 777, you should have no problem downloading them.

 

just chmod'ing the images folder does not have an effect on the files unless you issued chmod with the -R option.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

Thanks for your reply jim.

 

Just selected all images in image folder and did a CHMOD 777

 

For the images which went up with the original oscommerce installation, they all CHMOD 777 without a problem.

 

This i what I got for the images uploaded via oscommerce admin product uploads :

 

site chmod 777 /var/www/html/catalog/images/WynfordChrome.jpg

550 /var/www/html/catalog/images/WynfordChrome.jpg: Operation not permitted

 

 

Regards

 

Mazhar

Link to comment
Share on other sites

In your images folder, try:

touch WynfordChrome.jpg

chmod 777 WynfordChrome.jpg

and see if that does not help.

"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Link to comment
Share on other sites

I had a similar problem. Images uploaded by osCommerce are often owned by user "nobody" instead of you so you can't chmod them. The solution I found posted somewhere in these forums was to add this line

    chmod( $target, 0646 );

right after this line

    move_uploaded_file($filename['tmp_name'], $target);

in admin/includes/functions/general.php. Unfortunately this only fixes the problem for future uploads. I have a pretty small store, so I just re-uploaded all my pictures. For a larger store you would want to figure out how to do it programatically.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

Hi Jim

 

Sorry Jim, CHMOD'ing 777 on the image did not help.

 

I think Paul may have hit on the dilemma too.

The fact is I have had this image download problem on three of my sites. Each is seperate, on seperate servers. None of them will allow me to download images initially uploaded via the Admin. Whilst for many this may not pose an immediate problem, BUT moving a store from one server to another could prove to be very serious, if like me you have hundreds of images already uploaded.

 

Thanks Paul, I think I will search the forums to find a solution to salvage my existing images. ( If you remember the thread I would much appreciate it)

 

Thanks everyone.

 

Regards

 

Mazhar

Link to comment
Share on other sites

Unfortunately the thread I found previously only mentions adding the chmod line. You should be able to fix all the images, by executing code something like this:

    require( 'includes/configure.php' );

   $image_query = tep_db_query("select products_image from products");

   while ( $info = tep_db_fetch_array($image_query) )

   {

       $target = DIR_WS_CATALOG_IMAGES . $info['products_image'];

       chmod( $target, 0646 );

   }

This is thoroughly untested code, but hopefully will give you some idea of what you need.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

Hi Paul

 

Where does this code go?

 

Code:

require( 'includes/configure.php' );

$image_query = tep_db_query("select products_image from products");

while ( $info = tep_db_fetch_array($image_query) )

{

$target = DIR_WS_CATALOG_IMAGES . $info['products_image'];

chmod( $target, 0646 );

}

 

 

Do I simply replace code and CHMOd again?

Regards.

Link to comment
Share on other sites

maz,

 

I debugged the code and posted it with instructions in the Tips and Tricks forum here.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

Hi Paul

 

Followed your instructions. All images in catalog/Admin/images folder do show CHMOD 644.

 

However, I have always followed the OScommerce default pattern of uploading product images to the /catalog/images folder . All my product image uploads are in this catalog/images folder. My product upload images here show CHMOD 600. These are the ones which I cannot CHMOD or download.

 

Regards

Link to comment
Share on other sites

Did you create the chmodimages.php file and load it into a browser? For me the list in the browser showed files in the catalog/images folder and changed their permissions. If your files belong to nobody, you need to have 646 permissions so they will be readable by everybody, not just nobody. If they have 600 permissions then you can't read them so you can't download them.

In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...