Koozali.org: home of the SME Server

Cannot upload images to Ibay

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« on: March 24, 2005, 12:10:20 AM »
I cannot seem to upload any images to my ibay.
Is this another template fragment issue or something cause it works fine in my primary bay. Thanks

Ed
......

gavincowie

Cannot upload images to Ibay
« Reply #1 on: March 24, 2005, 12:39:37 AM »
"open_basedir" is in effect on ibays - you will need to specify a php upload location inside your ibay. Ordinarily by editing httpd.conf, tho in this case the templates make it a bit more tricky - I'm using a method that pulls in parameters from the e-smith accounts db - does anyone remember who wrote the code for the "httpdAdvanced" entry? Dan Brown, was it you?

Anyway it ends up like this : (all on one line)
php_admin_value upload_tmp_dir /home/e-smith/files/ibays/youribay/html/tmp_upload

You should be able to make the tmp_upload in the /files/ folder instead of html for more security.

G

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #2 on: March 24, 2005, 05:39:20 PM »
What I have is an ECommerce program that allows you to add products and browse for a picture and thumbnail to upload and associate with the product.

All is fine except that the image which should have been added to the database does not appear. I have tried several times and nothing seems to work.

I have a Mambo site running in my Primary that works on the same principal and I can do the same thing and browse for a file to upload and it works fine.

The Ibay site is the puzzler. Hope this makes my issue clearer. Thanks
......

gavincowie

Cannot upload images to Ibay
« Reply #3 on: March 24, 2005, 06:48:03 PM »
Quote
What I have is an ECommerce program that allows you to add products and browse for a picture and thumbnail to upload and associate with the product.

All is fine except that the image which should have been added to the database does not appear. I have tried several times and nothing seems to work.


Yeah, the uploading is the problem. By default, uploading via php will put it in /tmp - this is fine for the primary ibay, it doesn't have open_basedir restrictions on it. All other ibays do have the restriction, therefore they can't reach /tmp and the upload fails.

You'll need to tell apache to set that php_admin_value for the ibay so that the php uploading will go to a location that is "within" the openbasedir path restriction.

G

PS. when uploading with php, it doesn't matter where you tell (or where the script tells) the file to go to, be it in the filesystem or in a database. It will still first go to a temporary filesystem location as specified in the php.ini file as the upload is taking place.
[/quote]

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #4 on: March 24, 2005, 08:25:28 PM »
Quote
You'll need to tell apache to set that php_admin_value for the ibay so that the php uploading will go to a location that is "within" the openbasedir path restriction.


Thanks Gavin

Are you saying that I should create a template fragment in the /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf and add an entry that says what? (php_admin_value open_basedir /home/e-smith/files/ibays/store) is what it says right now in http.conf.
I'm confused by this open_basedir path restriction thing.

Thanks again
......

gavincowie

Cannot upload images to Ibay
« Reply #5 on: March 25, 2005, 08:04:56 AM »
You got it - the problem is creating template fragments for ibays is a particularly tricky case - a loop is used to set all the web parameters for the various ibays, so setting a particular param for a particular ibay requires a bit of lateral thinking. Fortunately, Dan Brown, one of the mental limbo champs around here has already done that thinking.

http://www.familybrown.org/howtos/advanced-ibay-howto.html

This is an old howto from 2001, but it's still applicable even if the line numbers have moved a bit.

Strange, I could only find this howto using yahoo(!) not google...

G

PS. Where Mr. Brown found the time to work on The Da Vinci code with all the SME hacking he's been up to over the past few years is beyond me.

Offline hardijs

  • ****
  • 77
  • +0/-0
gallery too?
« Reply #6 on: March 30, 2005, 02:21:27 PM »
may it be the same reason (or one of many) that breaks gallery (Knuddi install) too?

gavincowie

Big yeppers
« Reply #7 on: March 30, 2005, 06:29:47 PM »
Quote
may it be the same reason (or one of many) that breaks gallery (Knuddi install) too?
That's a big yes.

Using Dan Brown's referenced hack, I just made a tmp dir inside my ibay, did :

/sbin/e-smith/db accounts setprop myIbayName httpdAdvanced "php_admin_value upload_tmp_dir /home/e-smith/files/ibays/myIbayName/html/tmp"

all on one line, then:
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
and finally:
/etc/e-smith/events/actions/restart-httpd-graceful

I wonder if putting the tmp dir in files would have worked too...

G

Skydiver

SME 7.0 Alpha 3
« Reply #8 on: March 31, 2005, 02:34:14 AM »
Will this work with the SME ver i am using

i want to have followSymLinks . Will this allow access to the /tmp foulder within my system foulders rather then in the ibay itself.

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #9 on: March 31, 2005, 03:00:22 AM »
Gavin

What version of SME are you running?

I emailed Dan and he said that the instuctions were for version 4.1.2 and didn't think that the advanced properties would be necessary to allow uploading images (depending on how the store front system handled that).

Were the commands in your last message the only necessary steps or what part of Dan's instructions did you use? In version 6.0.1 that I am running the 90e-smithAccess40ibays file lines are nothing like the ones in version 4.1.2 so there is no way of knowing where to add them.
Thanks

Ed
......

Skydiver

SME 7.0 Alpha 3
« Reply #10 on: March 31, 2005, 03:03:48 AM »
i am using SME 7.0 Alpha 3

gavincowie

Cannot upload images to Ibay
« Reply #11 on: March 31, 2005, 03:22:18 AM »
Quote
i want to have followSymLinks . Will this allow access to the /tmp foulder within my system foulders rather then in the ibay itself.

To allow access to the /tmp folder you will have to disable the open_basedir restriction.

G

gavincowie

Cannot upload images to Ibay
« Reply #12 on: March 31, 2005, 03:35:37 AM »
edb,
Quote
I emailed Dan and he said that the instuctions were for version 4.1.2 and didn't think that the advanced properties would be necessary to allow uploading images (depending on how the store front system handled that).
yep, the instructions were for 4.1.2 - I used them on 5.1.2 and again on 5.6 with a bit of tweaking. I wouldn't have expected uploading to "just work" since php by default does want to put uploaded files into /tmp - and if the open_basedir restrictions are in effect...

Maybe we can get Dan in here... I'm out of touch :)

G[/quote]

Offline hardijs

  • ****
  • 77
  • +0/-0
Re: gallery
« Reply #13 on: March 31, 2005, 09:19:36 AM »
Quote from: "gavincowie"
Quote
may it be the same reason (or one of many) that breaks gallery (Knuddi install) too?
That's a big yes.



did the thing
did the complete ibay content delete and install a new - now works.

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #14 on: March 31, 2005, 04:03:58 PM »
What exactly did you do?

Where did you put this part of the code: line 130?

if ($properties{'httpdAdvanced'})
            {
                $result .= "# Advanced Properties\n";
                $result .= $properties{'httpdAdvanced'};
                $result .= "\n";
            }
The code preceeding this line looks nothing like the code in my file so I don't know where to add it.
......