Keyword

Image upload error K2.7 and J3.5

  • Miroslav
  • Miroslav's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #152417 by Miroslav
Image upload error K2.7 and J3.5 was created by Miroslav
Hi,
I had issue with uploading image to blog item.
I couldn't upload image and no error was showing in admin. This was on Joomla updated site to J3.5 and K2 was updated to v2.7 and on online hosting server. I couldn't get this error on localhost on Wamp.

I did some digging and found that problem is probably in J3.5, but I'm not 100% sure.
I fix that in item.php file (K2 administrator\components\com_k2\models) and alternated lines (around 276-279):
if (($files === 0 || $existingImage) && !JRequest::getBool('del_image'))
changed to
if (($files == 0 || $existingImage) && !JRequest::getBool('del_image'))

and
if ($files === 0)
changed to
if ($files == 0)

Not sure if this is correct, but after that I could upload image to item and didn't get any error.

Before that, I have tested K2 v2.7 on J4.8 and it is working fine online and local - I can upload image.
Uploading images on K2 v2.7 on fresh J3.5 install on local server is working as well.
Didn't have time to test fresh J3.5 install and k2 v2.7 on online server.

Also uploading video is working OK.

Maybe someone can check that code if there is not any issue.
Thanks.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #152440 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
Thank you for reporting this Miroslav.
We are looking into it.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago - 8 years 11 months ago #152449 by Adrian
Replied by Adrian on topic Image upload error K2.7 and J3.5
Hello,

I have the same problem. When I'm creating new article, the item image doesn't save but without any error. This is very important error for my news site.

Edit: Miroslaw, your solution is work for me, thank you :)
Last edit: 8 years 11 months ago by Adrian.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #152459 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
Hello Andrian,
Unfortunately I cannot verify the issue.
Which other extensions are you using?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152471 by Adrian
Replied by Adrian on topic Image upload error K2.7 and J3.5
I don't use any other extensions, only K2.7 and J3.5. Miroslaw's solution is works for me:

"===" changed to "==" in 2 lines in administrator/components/com_k2/models/item.php

Is this a bug in new K2?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #152472 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
I cannot verify it, in my K2 sites. I am using 3.5 as well.
It could be related to a PHP version? Which PHP version are you using?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152473 by Adrian
Replied by Adrian on topic Image upload error K2.7 and J3.5
PHP 5.6 and 7... Both with problem described and solved by Miroslav. I'm not an expert, so I don't know why "==" instead "===" makes difference.

Please Log in or Create an account to join the conversation.

  • Miroslav
  • Miroslav's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago - 8 years 11 months ago #152477 by Miroslav
Replied by Miroslav on topic Image upload error K2.7 and J3.5
Hi,

I have PHP 5.4.16 on local and it is working fine.

Online server has PHP 5.4.24 and I can't upload file there.
Strange is that I can upload file via media manager or via function "Browse server" and upload image there.
So, this is way around if someone don't want change that code.

I think it is more J3.5 issue related, because as I have mentioned above, on online hosting server K2 v2.7 is working OK on J3.4.8.
Not sure but maybe clean function in input.php in libraries\joomla\filter. Didn't dig further.

I hope this helps.
Last edit: 8 years 11 months ago by Miroslav. Reason: misspelling

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152479 by Ivica Dajak
Replied by Ivica Dajak on topic Image upload error K2.7 and J3.5
Something is definitely happening with this issue.

I have numerous sites with similar setup (joomla 3.5 / k2 2.7) - I noticed this issue on one of the sites and Miroslav's fix did the trick.

However, seems that's the only site it's happening on, and I have this combination on at least dozen sites over 4 different servers. Also, I don't think it's PHP version as I have same PHP 5.4.45 on one site which has the problem, and on the other which don't.

Happy to see K2 versions moving forward, hope this issue will be fixed. I will do some further investigation myself to try to determine if it's server or joomla related issue.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152485 by Moussa
Replied by Moussa on topic Image upload error K2.7 and J3.5
Joomla 3.5
k2 2.7
PHP 5.4.35

I confirm Miroslav solution.

276-279 in administrator/components/com_k2/models/item.php
Change '===' by '==' resolved the issue.

The same issue resolved in category.php

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152499 by Lefteris
Replied by Lefteris on topic Image upload error K2.7 and J3.5
Hi,

The tripple equal sign operator checks a value by it's type. According to the official PHP documentation the upload errors should be integers: php.net/manual/en/features.file-upload.errors.php . So, i don't see the reason this is not working in some sites. In any case, i have applied the fix to the repository: github.com/getk2/k2/commit/6450ba69378318aeb974d2c72d8990f298f00781 .

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152571 by Thomas Thrane
Replied by Thomas Thrane on topic Image upload error K2.7 and J3.5
I had the same issue on 2 sites.
When using PHP 7.0.4 the issue went away and things seems fine?
No need of changing the source code.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152579 by algerka
Replied by algerka on topic Image upload error K2.7 and J3.5
Yes, this solution is work

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152596 by Laurent Robin
Replied by Laurent Robin on topic Image upload error K2.7 and J3.5
thanks all for the fix. had the same issue. replaced the === with == in item and category.php and it works now.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152598 by George Sickler
Replied by George Sickler on topic Image upload error K2.7 and J3.5
I did these fixes, and I still got this error with a box that shows up. It wont upload the images or even the item unless the extra fields box is field out with some text in the video link and slide images fields.

So I just put my titles in there and it lets me continue, but how can we fix this? I tried to upload an image, but the add file link for an attachments wont work.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152618 by Frédéric
Replied by Frédéric on topic Image upload error K2.7 and J3.5
Thank you (merci) for your fix...it works for me now...

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #152622 by Thomas Thrane
Replied by Thomas Thrane on topic Image upload error K2.7 and J3.5
The fix didn't work for me, but after upgrading to PHP 7.0.4. the issue was gone!

So Joomla 3.5 + K2 2.70 + PHP 7 works for me!

Please Log in or Create an account to join the conversation.

  • Litho-Verlag e.K.
  • Litho-Verlag e.K.'s Avatar
  • Offline
  • Senior Member
More
8 years 11 months ago #152756 by Litho-Verlag e.K.
Replied by Litho-Verlag e.K. on topic Image upload error K2.7 and J3.5
Hi the solution works!
But just a short question
in
/administrator/components/com_k2/models

in
item.php
and
catergory.php
I found 3 times "==="
I replaced them all with "==".

DId I do right?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #152797 by Krikor Boghossian
Replied by Krikor Boghossian on topic Image upload error K2.7 and J3.5
Hello Litho,

The '===' checks should be located in lines 276-279.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Litho-Verlag e.K.
  • Litho-Verlag e.K.'s Avatar
  • Offline
  • Senior Member
More
8 years 11 months ago #152888 by Litho-Verlag e.K.
Replied by Litho-Verlag e.K. on topic Image upload error K2.7 and J3.5
Hi Krikor,
thanks for your confirmation.

that's right for the item.php

but for the category.php are the lines: 86-88.

regards
Litho

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum