Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

File permissions on image upload problem


topmate

Recommended Posts

When uploading product images via the admin section my December snapshot sets the file permissions to owner read and write only, giving no public access. Essentially this means I am met with a page of broken links.

 

I've searched through the forums and found nothing specific on this. I'm able to get around it by deleting the images and re-uploading via FTP, but its an untidy solution at best. Is there a way to allow the images to be uploaded with different file permissions when I'm adding products via admin?

Link to comment
Share on other sites

Mark,

Apply the following change to your admin/includes/functions/general.php file (around lines 780 - 790).

 

Find this:

// the $filename parameter is an array with the following elements:

// name, type, size, tmp_name

 function tep_copy_uploaded_file($filename, $target) {

   if (substr($target, -1) != '/') $target .= '/';



   $target .= $filename['name'];



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



 }

 

Replace with this:

I have commented where the chmod change has been made for easy reference.

// the $filename parameter is an array with the following elements:

// name, type, size, tmp_name

 function tep_copy_uploaded_file($filename, $target) {

   if (substr($target, -1) != '/') $target .= '/';



   $target .= $filename['name'];



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



// chmod added - start

chmod ("$target", 0776);

// chmod added - end



 }

 

This should sort out your problems... :D

 

Post again to thread if you're still having problems.

 

Cheers,

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...