Guest Posted November 17, 2004 Posted November 17, 2004 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.
rwolleben Posted November 17, 2004 Posted November 17, 2004 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. <{POST_SNAPBACK}> 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.
rwolleben Posted November 18, 2004 Posted November 18, 2004 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>
goblin636 Posted November 18, 2004 Posted November 18, 2004 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> <{POST_SNAPBACK}>
Cowzor Posted August 8, 2005 Posted August 8, 2005 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> <{POST_SNAPBACK}> What file would you insert the code from Option 2 into? Cheers! :huh:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.