• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Can't upload user image

Status
Not open for further replies.

buzzdee

Chevereto Member
Hi,
as mentioned here before, i can't upload a profile pic or a profile background image.
I did a fresh, clean install, but no luck: The loading circle is spinning....and spinning... but no upload !
 
PHP:
Warning: tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/web97/html/:/var/www/web97/phptmp/:/var/www/web97/files/:/var/www/web97/atd/:/usr/local/php5.5/lib/php/:/usr/local/php5.5/pear/) in /var/www/web97/html/buzzpics/app/lib/classes/class.upload.php on line 216

Try this:

1. Open app/lib/classes/class.upload.php
2. Find this:
PHP:
        if(!$this->downstream) {
            throw new UploadException("Can't get a tempnam", 200);
        }
3. Replace with:
PHP:
        if(!$this->downstream or !is_writable($this->downstream)) {
            $this->downstream = tempnam($this->destination, 'chvtemp');
        }
 
Hi Rodolfo,
Thanks for your quick answer, but this seems to have no effect. Uploading of images in general doesn't work (including user pic). Got the same open_basedir warning... :(

Edit:
Mhmm... ok, now the upload works, but in the frontend there is a error message.
http://demo.chevereto.com/image/BmZ
but the images have been uploaded...
 
Last edited:
Did you notice the error log thag I posted?
PHP:
Warning: tempnam(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/web97/html/:/var/www/web97/phptmp/:/var/www/web97/files/:/var/www/web97/atd/:/usr/local/php5.5/lib/php/:/usr/local/php5.5/pear/) in /var/www/web97/html/buzzpics/app/lib/classes/class.upload.php on line 216

That is a server error.

http://stackoverflow.com/questions/...n-effect-file-is-not-within-the-allowed-paths
 
Did you notice the error log thag I posted?
Yes, and now I know that the problem is the open_basedir restriction aka no write access to /tmp folder.
I think we need a workaround for this, because there are many, many hosters who don't allow writing to /tmp folder.
Or at least, we need a way to specify the temp-folder. In my case, the writable temp-folder is named "phptmp"...
 
Try this:
PHP:
        if(!$this->downstream or !@is_writable($this->downstream)) {
            $this->downstream = tempnam($this->destination, 'chvtemp');
        }
 
if(!$this->downstream or !@is_writable($this->downstream)) {$this->downstream = tempnam($this->destination, 'chvtemp');
}
Still no luck with ^this code...
Although the image is in fact uploaded successfully, there is an error afterwards (see screenshot).


I heavily discussed the "/tmp" problem with my hoster today, and they won't change their php settings :(
Therefore I really beg you to find a workaround for those people who have this problem :)

As a dirty workaround I replaced this
PHP:
$this->downstream = tempnam(sys_get_temp_dir(), 'chvtemp');
with this
PHP:
$this->downstream = tempnam('/var/www/web97/phptmp', 'chvtemp');
and it works ... but I#d like to have a professional solution ;)
 
Last edited:
Change this:
PHP:
        // Set the downstream file       
        $this->downstream = tempnam(sys_get_temp_dir(), 'chvtemp');
       
        if(!$this->downstream) {
            throw new UploadException("Can't get a tempnam", 200);
        }

To this:
PHP:
        // Set the downstream file       
        $this->downstream = @tempnam(sys_get_temp_dir(), 'chvtemp');
       
        if(!$this->downstream or !@is_writable($this->downstream)) {
            $this->downstream = @tempnam($this->destination, 'chvtemp');
            if(!$this->downstream) {
                throw new UploadException("Can't get a tempnam", 200);
            }
        }

Btw you should also try beg your host to fix their crappy PHP setup.
 
Status
Not open for further replies.
Back
Top