Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

files are not uploaded in item's attachments without showing any error #490

Open
swallown opened this issue Oct 4, 2019 · 39 comments
Open

Comments

@swallown
Copy link

swallown commented Oct 4, 2019

In attachment file list (backend), the file name is shown in the download link title attribute and the file name appears empty, as shown in the image. The result in frontend is a broken link that shows "file not found" and really file is not on the server

K2 v2.10.0 [Dev Build 20190915]
Joomla! 3.9.12
PHP 7.2
IIS 8

upload-file-attachment-issue

@fevangelou
Copy link
Member

Make sure your PHP setup include the module "fileinfo".

@swallown
Copy link
Author

fileinfo extension for php 7.2 on IIS solves it. I understand that it is a new requirement for branch k2 > v2.9.1 and later. Thank you fevangelou.

@fevangelou
Copy link
Member

I'm not really sure to be honest but I doubt so. This requirement basically comes from upload.class.php, a PHP class we use since K2 v2.0.0 (of course updated across the years). I think that on IIS, this module was a default installation but for some reason this may have changed with PHP 7.2+.

@swallown
Copy link
Author

I have precipitated a bit, installed and configured the extension "fileinfo", now allows the upload and download of documents, but its extension is modified to .tmp I think I have all my php installation well configured and other extensions upload documents without problems what can I be skipping?

@fevangelou
Copy link
Member

Have a look at this: symfony/symfony#22702 (comment)

@fevangelou fevangelou reopened this Oct 18, 2019
@swallown
Copy link
Author

Ok Fotis, I'm going to review all this and report you. What I can tell you is that I use K2 since its first versions with joomla 1.5 and I have never needed the fileInfo extension or had problems with k2 attachments & files mimetype. Thank you very much for your invaluable help.

@fevangelou
Copy link
Member

As I already mentioned, perhaps the issue is specific to newer PHP builds for IIS/Windows as it's been reported to me by exactly 3 more users, who were all missing that module for PHP. But then again, in your case it may extend to the additional libraries' version (as indicated by the link I gave you) to wrong or incomplete MIME detection (which may "touch" IIS too).

Let me know in any case.

@swallown
Copy link
Author

I'm in it, but I forgot to tell you that I hosted on IIS server with multiple domains all K2 v2.9.0 seamlessly with different versions of PHP versions (from 5.5.11 to 7.2.7) with all the necessary extensions (now including fileInfo in php.ini) that I can apply and change at will to test, and this problem only appears on a test site with K2 v2.10.0 [Dev Build 20190915]. I reiterate my thanks, I will tell you soon

@fevangelou
Copy link
Member

K2 v2.10.0 includes a newer version of the upload PHP class which is up to PHP 7.3 compatible. I'll also check for any updates but it should be fairly simple to replace it with any new version for testing.

Grab the latest version from here: https://raw.githubusercontent.com/verot/class.upload.php/master/src/class.upload.php

...and replace the file with the same name in: /media/k2/assets/vendors/verot/class.upload.php/src/

@swallown
Copy link
Author

just updated upload.class.php from the link provided (edited to remove the namespace and changing the class name with lowercase for compatibility with K2 code). But the result is the same, it does work -particularly- only with documents with TXT extension, but the title attribute does not.

I must mention and emphasize that the result in the list of attachments (as can be seen in the image and now with fileInfo), and once the files are uploaded, is that the value specified in the title attribute field is replaced by the correct file names and in the file names column appears with the extension "tmp" (that is how they are on the server).

I have now checked with the fileinfo extension that by downloading the file-xxx.tmp in frontend and then changing the extension to the correct one (pdf for example) the document is binary exact to the original and opens as it should. Sorry, I find it very strange, I say this in case any hidden or rare inconsistency in the code of K2 v2.10.0 with IIS is possible, since it does not occur in K2 v2.9 (which works perfectly even without the fileInfo extension of PHP 7.2 , 7.1, 7.0, 5.xx for years). Thank you

attachments-issue

@fevangelou
Copy link
Member

This probably points to MIME detection issues. The title is just a read out of the actual filename, before any processing by the upload class.

@fevangelou
Copy link
Member

Make sure you have the right MIME types. I suppose you edit them in IIS like so: https://manage.accuwebhosting.com/knowledgebase/2443/How-to-set-MIME-types-for-web-fonts-in-IIS.html

@swallown
Copy link
Author

This probably points to MIME detection issues. The title is just a read out of the actual filename, before any processing by the upload class.

ok, but the string specified in the field of link atribute are replaced with file name, as if you don't write there anything

@fevangelou
Copy link
Member

"The title is just a read out of the actual filename". 😃

@swallown
Copy link
Author

Make sure you have the right MIME types. I suppose you edit them in IIS like so: https://manage.accuwebhosting.com/knowledgebase/2443/How-to-set-MIME-types-for-web-fonts-in-IIS.html

yes, all mimetypes are set globally ok on IIS

@fevangelou
Copy link
Member

Have a look at the other aspects of the issue described in the Symfony GitHub link please.

@swallown
Copy link
Author

of course ! but this take more time. Thank you Fotis

@moritzpg
Copy link

moritzpg commented Nov 8, 2019

Hi shallown, we also have the same problem with K2 v2.10.0 - PHP 7.2.15 and Microsoft IIS. Have you found a solution?
Thank you.

k2

@fevangelou
Copy link
Member

Did you make sure the fileinfo PHP module is installed?

@moritzpg
Copy link

moritzpg commented Nov 8, 2019

Yes, the fileinfo PHP module is installed.

k22

@fevangelou
Copy link
Member

When uploading, do you get any warnings/errors in your logs?

@swallown
Copy link
Author

swallown commented Nov 8, 2019

Hi shallown, we also have the same problem with K2 v2.10.0 - PHP 7.2.15 and Microsoft IIS. Have you found a solution?
Thank you.

Hi moritzpg I'm on it and tried everything but without any solution yet. I've tried everything, even overriding the parameters of class class.upload.php as $ mime_check = false; and similar: I can't find a solution yet.

It is strange that joomlaworks has not used the native joomla file system and even that class class.upload.php is out of the joomla administrator folder, so I have also investigated about the permissions that a windows system has.

I have found that previous versions of php 7 have had problems about the detection of mime types because some specific files of the fileinfo extension were missing, but there is no reference or subsequent clue that leads to solving this damn issue.

Of course I am doing all the tests on a development and testing platform with K2 2.10.XX, but I cannot afford to find myself in a dead end. I am aware of the specificity of using IIS in joomla, which I have been doing for more than 10 years, but I have never encountered anything like this. I must say that if I find a solution, I will gladly share it here. And I am in it.

I would thank the community and especially to the developers of K2 some light to continue trying to find a solution to this, before entering fully in the series 4 of joomla, temptation that this problem be transferred to the supposed and future compatible version of K2, and forces us to think about changing the content management system.

Thank you very much and sorry for my English, I hope you have understood me.

@swallown
Copy link
Author

swallown commented Nov 8, 2019

The "rudimentary" system of attached documents of K2 is fundamental for this type of components, without which and despite all the advantages of the rest of the features, without the attached document manager, nothing makes sense. I say this because despite the great attention of Fotis / Joomlaworks, I notice this somewhat stopped and it worries me. I hope you understand me. Thank you

@swallown
Copy link
Author

swallown commented Nov 8, 2019

When uploading, do you get any warnings/errors in your logs?

Hi Fevangelou, there is no trace of any error, neither in the php logs, nor forcing the development messages in joomla or with any type of tracing tool. The effect that I have already mentioned before is that the documents are available in .TMP extension, which makes it obviously unusable and even if it seems a simple matter. Goodnight.

@swallown
Copy link
Author

swallown commented Nov 8, 2019

I want to insist that with IIS, joomla has never needed the fileinfo extension for any component of any kind and that needs to upload/download files, regardless of this special result

@fevangelou
Copy link
Member

If no errors are logged, you may need to make error logging more verbose in Joomla's configuration (so set it to maximum and check the upload process again).

K2's image processing and upload library (class.upload.php) is what requires the fileinfo module. In any case, there is a newer release which I will be integrating into K2 v2.10.0 or 2.10.1.

If the update does not address the problem, I will make a custom implementation to address support for uploading on IIS.

Working now to get v2.10 out next week, so make sure you keep an eye on social and on getk2.org for the new release. Once it's out, test again please.

@moritzpg
Copy link

moritzpg commented Nov 10, 2019

Hi fevangelou, I did a new test from scratch installing a clean version of joomla 3.9.13 and k2_v2.90. I uploaded a .pdf file without problems. Subsequently, I updated the component to K2 v2.10.0 version, set the Error Reporting to maximum and performed a new upload test. With non errors, the file extension is changed to .tmp.

k2v210

Thank you

@fevangelou
Copy link
Member

2.9.0 uses an older version of class.upload.php. It's changed a lot since then.

I've already added in my notes to upgrade the library for the upcoming v2.10 release of K2 next week.

@swallown
Copy link
Author

swallown commented Nov 15, 2019

If no errors are logged, you may need to make error logging more verbose in Joomla's configuration (so set it to maximum and check the upload process again).

K2's image processing and upload library (class.upload.php) is what requires the fileinfo module. In any case, there is a newer release which I will be integrating into K2 v2.10.0 or 2.10.1.

If the update does not address the problem, I will make a custom implementation to address support for uploading on IIS.

Working now to get v2.10 out next week, so make sure you keep an eye on social and on getk2.org for the new release. Once it's out, test again please.

Good morning, I just upgraded to version 2.10.0 both updating from joomla and installed from getk2.org. The result remains the same: the extensions of the uploaded files change to .TMP

There are no problems loading and processing items's images as well as the .ZIP files for SIG Pro

Since it is an official update, it would be appropriate that joomlaworks and getk2.org notify users with IIS that they will run out of the attachment manager

@swallown
Copy link
Author

swallown commented Nov 15, 2019

If the update does not address the problem, I will make a custom implementation to address support for uploading on IIS.

We could know an approximate date estimation for the availability of this implementation for IIS ? Thank you

@fevangelou
Copy link
Member

I can't give you a time estimate because I'm not using IIS and I'd need to prepare such a setup which takes time. I'm not even a Windows user for starters...

As a workaround, you can try inserting attachments using the "browse server" option (you can upload files there too).

@swallown
Copy link
Author

I can't give you a time estimate because I'm not using IIS and I'd need to prepare such a setup which takes time. I'm not even a Windows user for starters...

As a workaround, you can try inserting attachments using the "browse server" option (you can upload files there too).

Ok, understood, it's not a bad temporary solution, but some of our content managers are going to tell me something not good, hehe. If I can help you with something tell me here. Thank you

@swallown
Copy link
Author

Good afternoon, I just updated to version 2.10.1:
The result remains the same: the extensions of the uploaded files change to .TMP

@fevangelou
Copy link
Member

I didn't make any changes as the issue points to MIME detection problems. I need more time to work around this.

@fevangelou
Copy link
Member

All, please test K2 v2.10.4 (dev) from https://getk2.org/downloads/?f=K2_Development_Release.zip - it contains various fixes (even related to MIME detection) that should resolve the file attachment issue you all had with prior K2 versions.

Let me know.

@moritzpg
Copy link

moritzpg commented Jun 8, 2020

It works, great job!!!

Thank you Fotis

@fevangelou
Copy link
Member

Great :)

@swallown
Copy link
Author

it works for me too !!

Thank you very much Fotis

@fevangelou
Copy link
Member

That's good to know @swallown :) Thanks for getting back to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants