Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

No product images showing?


Guest

Recommended Posts

Posted

I have a new install and I'm adding products from the catalog admin, but the images aren't showing up (showing as broken image). Please advise.

Posted
I have a new install and I'm adding products from the catalog admin, but the images aren't showing up (showing as broken image). Please advise.

 

I have that same problem.

I am getting this warning after trying at add a image to a product.

 

Warning: move_uploaded_file(): open_basedir restriction in effect. File(/root/catalog/images/accelerator2.gif) is not within the allowed path(s): (/path/to/root) in /root/catalog/admin/includes/classes/upload.php on line 94

Error: File upload not saved.

 

I made sure that my /root/catalog/images directory is CHMOD'ed to 777.

 

ps. I am using a shared server.

Posted

Well, after alot of ripping apart code and nothing happening, I have come to a conclusion. The problem does not lie in osCommerce, but in server permissions for the tmp directory. This usually happens if you're running PHP as an Apache module, or if you are using shared web hosting & your host doesn't want to give you access to the tmp directory.

 

There are two solutions that I found:

1) Try running PHP as CGI instead of Apache.(I did this and it works!)

2) Implement this code into your program. It changes the original upload directory to whatever your root directory is.

 

<br><pre>

$root = realpath($_SERVER['DOCUMENT_ROOT']);

$uploaddir = $root.'/stuff/';

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

echo ($uploadfile);

 

print "<pre>";

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

print "File is valid, and was successfully uploaded. ";

print "Here's some more debugging info:\n";

print_r($_FILES);

} else {

print "Possible file upload attack! Here's some debugging info:\n";

print_r($_FILES);

}

</pre>

Posted
Well, after alot of ripping apart code and nothing happening, I have come to a conclusion.  The problem does not lie in osCommerce, but in server permissions for the tmp directory.  This usually happens if you're running PHP as an Apache module, or if you are using shared web hosting & your host doesn't want to give you access to the tmp directory. 

 

There are two solutions that I found:

1) Try running PHP as CGI instead of Apache.(I did this and it works!)

2) Implement this code into your program.  It changes the original upload directory to whatever your root directory is.

 

<br><pre>

$root = realpath($_SERVER['DOCUMENT_ROOT']);

$uploaddir = $root.'/stuff/';

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

echo ($uploadfile);

 

print "<pre>";

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

print "File is valid, and was successfully uploaded. ";

print "Here's some more debugging info:\n";

print_r($_FILES);

} else {

print "Possible file upload attack! Here's some debugging info:\n";

print_r($_FILES);

}

</pre>

  • 8 months later...
Posted
Well, after alot of ripping apart code and nothing happening, I have come to a conclusion.  The problem does not lie in osCommerce, but in server permissions for the tmp directory.  This usually happens if you're running PHP as an Apache module, or if you are using shared web hosting & your host doesn't want to give you access to the tmp directory. 

 

There are two solutions that I found:

1) Try running PHP as CGI instead of Apache.(I did this and it works!)

2) Implement this code into your program.  It changes the original upload directory to whatever your root directory is.

 

<br><pre>

$root = realpath($_SERVER['DOCUMENT_ROOT']);

$uploaddir = $root.'/stuff/';

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

echo ($uploadfile);

 

print "<pre>";

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

print "File is valid, and was successfully uploaded. ";

print "Here's some more debugging info:\n";

print_r($_FILES);

} else {

print "Possible file upload attack! Here's some debugging info:\n";

print_r($_FILES);

}

</pre>

 

 

What file would you insert the code from Option 2 into?

 

Cheers! :huh:

Archived

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

×
×
  • Create New...