Jump to content



Latest News: (loading..)

- - - - -

Unable to Upload Product Images


  • Please log in to reply
3 replies to this topic

#1   fdegree

fdegree
  • Members
  • 47 posts
  • Real Name:CDC

Posted 21 August 2012 - 05:25 PM

Using osCommerce Online Merchant v2.3.1

I tried to upload an image for a product I want to add, and I got the following warnings:
________________________

Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/tmp/phpW6kM0Z) is not within the allowed path(s): (/home/xxxxx/public_html/catalog/) in /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php on line 86

Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/tmp/phpW6kM0Z) is not within the allowed path(s): (/home/xxxxx/public_html/catalog/) in /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php on line 86

Warning: move_uploaded_file(/tmp/phpW6kM0Z) [function.move-uploaded-file]: failed to open stream: Operation not permitted in /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php on line 86

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpW6kM0Z' to '/home/xxxxx/public_html/catalog/images/licensekey.png' in /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php on line 86

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php:86) in /home/xxxxx/public_html/catalog/admin/includes/functions/general.php on line 34
_________________________

If it helps...
Here is /home/xxxxx/public_html/catalog/admin/includes/classes/upload.php lines 86 and 87
	if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) {
	  chmod($this->destination . $this->filename, $this->permissions);
Here is /home/xxxxx/public_html/catalog/admin/includes/functions/general.php line 34
	header('Location: ' . $url);

catalog/images folder permission is set to 755

I have uploaded images before, through the admin image upload manager, not sure what has happened now.  Obviously, I've done something to it.

Edited by fdegree, 21 August 2012 - 05:37 PM.


#2   MrPhil

MrPhil
  • Members
  • 4,135 posts
  • Real Name:Phil
  • Gender:Male

Posted 22 August 2012 - 03:24 PM

Don't worry about the "Cannot modify header" message -- when you fix the other error, this one will go away.

Check to see if the files were successfully uploaded by the HTML form to /tmp/<some temp name>. If so, the file exists but PHP is refusing to move it to its final home. You might have to make a php.ini entry to add /tmp to the allowed directory list (I don't recall what the exact filepath syntax is), or maybe you can turn off the "open_basedir restriction" (ask your host).

If the files were not even uploaded to /tmp in the first place, you might have to change the admin entry for the directory to use for the temporary upload storage (from /tmp to something else, probably under /home/xxxxx/public_html/).

#3   fdegree

fdegree
  • Members
  • 47 posts
  • Real Name:CDC

Posted 22 August 2012 - 06:01 PM

Thank you for responding...

I am assuming the /tmp folder I should look in is the  /home/xxxxx/tmp  folder.  There is no image file in this folder, just more folders.

I don't follow your instructions if the file never uploaded to the /tmp folder in the first place.  Could you be more specific?

Thanks...


PS -  I did figure a manual way to get the images installed and showing in the catalog as well as in the admin...I manually uploaded the image file to the catalog/images folder.  I then went into phpMyAdmin...selected my database from the list of databases...selected products from the list of tables...selected edit for the product that I was trying add an image for...beside products_image I removed the check from the Null check box and entered the image file name as the value.  Now the image is showing everywhere I need it show.  But, it would be nice to get the admin image upload manager working as it should.

#4   MrPhil

MrPhil
  • Members
  • 4,135 posts
  • Real Name:Phil
  • Gender:Male

Posted 23 August 2012 - 12:48 AM

If you want to use /home/xxx/tmp (or more likely, /home/xxx/public_html/tmp), you've got a wrong setup somewhere. The error message tells you that you're writing to /tmp. Probably you have an entry '/tmp' that should be 'tmp' (no slash) in your configuration, if you're not allowed to read or write /tmp. In your admin, in configuration, there are two places where /tmp is used:
  • Cache Directory is /tmp/, and may have to be changed to tmp/
  • Session Directory is /tmp, and may have to be changed to tmp
This is from memory, and I'm sure this has been discussed many times before (search for "tmp"). You might want to read other discussion on this before trying to make changes, if you're not allowed to read/write /tmp (a system directory).