PivotX 2.2.2 Image Upload does not work

This is the place to discuss bugs that have been found in the most recent version of PivotX. Posting bugs will ensure that the Development Team is aware of them and that they will be addressed when resources are available.

Re: PivotX 2.2.2 Image Upload does not work

Postby Mikeb » Tue Apr 05, 2011 9:00 pm

Here is something for you to chew on also...

If I change the file permissions manually to 644 by ftp, in firefox I still get no thumbnail, but where the thumb should be I get a link to the original file (this obviously doesn't happen at 600), but in chrome I just get a dead picture box (file missing) without a link!!!

It may not be important, I really don't know...
User avatar
Mikeb
 
Posts: 16
Joined: Sun May 30, 2010 8:14 pm
Location: Wakefield, UK

Re: PivotX 2.2.2 Image Upload does not work

Postby Mikeb » Sun Apr 17, 2011 11:29 pm

Hi Hans,
You are obviously busy and I like to solve my own problems when I can. I also know this fix will disappear on upgrade, but I have fixed my problem by simply adding the line:

Code: Select all
chmod($_FILES['file']['tmp_name'],0644);


To "fileupload.php" at line 196...

Code: Select all
if ($in) {
                while ($buff = fread($in, 4096))
                    fwrite($out, $buff);
            } else
                die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
            fclose($out);
   
          chmod($_FILES['file']['tmp_name'],0644);

            unlink($_FILES['file']['tmp_name']);


This doesn't help already uploaded pages/entries, I can not seem to add a picture to these (in the place I want), but this isn't an issue for me as I am still on the test server at the moment and can delete them and start again - I haven't had time to fully test either, will do later in the week.

Hope this helps towards solving other's file upload issues

Mike

P.S. I should point out the only code language I know, was Pascal & now some visual basic. I looked up the chmod online as i knew this was the thing that was not happening and as luck would have it, it seems to be the shortest possible solution too! :)
User avatar
Mikeb
 
Posts: 16
Joined: Sun May 30, 2010 8:14 pm
Location: Wakefield, UK

Re: PivotX 2.2.2 Image Upload does not work

Postby Mikeb » Tue May 03, 2011 8:44 pm

Hi, I am sorry to come back to this issue again, but my host tells me it isn't anything to do with them and..
The method that your CMS uses to upload files is not a method that we can support, as it works around the security measures we have in place on the server.


I have the file upload working anyway, as stated in my last post, though I changed the code again to the following, it works every time (the one above decided to work intermittently...

I just added this chmod as the second to last line
Code: Select all
chmod($targetDir . DIRECTORY_SEPARATOR . $fileName, 0644);
// Return JSON-RPC response die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');


My problem now is that timthumb creates the thumbnail with file permissions of 0600, though I can not understand the code to add another chmod.
Could one of you kind people please guide me onto where to add chmod code and what variables point to the file name.
I understand that it is unlikely to go into a release as I know this is isolated to this server.

If you would like to see the server host response I can post it if anyone is interested.

Thanks again
Mike
User avatar
Mikeb
 
Posts: 16
Joined: Sun May 30, 2010 8:14 pm
Location: Wakefield, UK

Re: PivotX 2.2.2 Image Upload does not work

Postby dmd » Sun Oct 09, 2011 5:21 pm

Tried upgrading from 2.0.2 to 2.3.0 and am facing this issue.

2.0.2: Files are uploaded as 644, Thumbnails created
2.3.0: Files are uploaded as 640 (-> HTTP 403), no Thumbnails created
dmd
 
Posts: 6
Joined: Sun Oct 09, 2011 4:48 pm

Re: PivotX 2.2.2 Image Upload does not work

Postby Harm10 » Sun Oct 09, 2011 6:48 pm

Just to be sure: you have value 0644 on Configuration / Debug / Chmod?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: PivotX 2.2.2 Image Upload does not work

Postby dmd » Sun Oct 09, 2011 7:09 pm

yes, 0644
I upgraded to V2.1.2 (which still works).
dmd
 
Posts: 6
Joined: Sun Oct 09, 2011 4:48 pm

Re: PivotX 2.2.2 Image Upload does not work

Postby hansfn » Sun Oct 09, 2011 8:49 pm

Version 2.1.2 is vulnerable - please don't use it.

I think we forgot to fix the file permission issue. Please try adding

Code: Select all
// Ensure the uploaded file has the correct file permission.
chmodFile($targetDir . DIRECTORY_SEPARATOR . $fileName);

just before

Code: Select all
// Return JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

at the very end of fileupload.php. If this works for you, I'll commit the fix now and it will be part of PivotX 2.3.1.

Maybe the thumbnail issue also is resolved when the permission is fixed. (That is a different bug anyway - needs a new topic.)
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: PivotX 2.2.2 Image Upload does not work

Postby dmd » Sun Oct 09, 2011 9:10 pm

I had tried mikeb's
chmod($targetDir . DIRECTORY_SEPARATOR . $fileName, 0644);
and it worked. The thumbnail was also created with this line in effect, but with the same wrong permission 0640.
dmd
 
Posts: 6
Joined: Sun Oct 09, 2011 4:48 pm

Re: PivotX 2.2.2 Image Upload does not work

Postby hansfn » Sun Oct 09, 2011 10:20 pm

Thx, but I need you to test with my code - to be 100% sure it's right (in stead of just 99%). mikeb's code is a hack since it's ignoring the chmod setting in PivotX.

Regarding the thumb: This is manually created thumbs, right, or did you get auto creation to work? (If so, where?) Anyway, I think the fix is to insert,

Code: Select all
chmodFile($thumbfilename);

right before

Code: Select all
ImageDestroy($dst);

around line 136 in the function gd_crop if the file modules/module_imagefunctions.php.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: PivotX 2.2.2 Image Upload does not work

Postby dmd » Mon Oct 10, 2011 5:59 am

Tested both and works. You're right that I still need to thumbnail manually.
dmd
 
Posts: 6
Joined: Sun Oct 09, 2011 4:48 pm

PreviousNext

Return to 2.x Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron