- Posts: 21
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Attachments STILL broken? Problems with MP3 files being renamed to TXT
Attachments STILL broken? Problems with MP3 files being renamed to TXT
- Chad Criswell
- Topic Author
- Offline
- Junior Member
Less
More
4 years 8 months ago - 4 years 8 months ago #174940
by Chad Criswell
Attachments STILL broken? Anything we attach to a K2 article changes extension was created by Chad Criswell
This has been occurring for well over a month now back to 2.10's release and is still going on after I updated to 2.10.2 today.
When we attach a PDF file to a K2 article it uploads fine but then it changes the filename from filename.pdf to filename.txt. See the attached image to see what I mean. This worked fine prior to 2.10!
Any idea what is going on? I see there are other posts on here about this same issue...
Also, here is a quick video showing what I am talking about.
drive.google.com/file/d/1_xZBD0uUY_A5vNdBJ9y0z5Bu4xu4ve8D/view
I also tried updating to the 2.10.3 dev release and the problem persists.
When we attach a PDF file to a K2 article it uploads fine but then it changes the filename from filename.pdf to filename.txt. See the attached image to see what I mean. This worked fine prior to 2.10!
Any idea what is going on? I see there are other posts on here about this same issue...
Also, here is a quick video showing what I am talking about.
drive.google.com/file/d/1_xZBD0uUY_A5vNdBJ9y0z5Bu4xu4ve8D/view
I also tried updating to the 2.10.3 dev release and the problem persists.
Last edit: 4 years 8 months ago by Chad Criswell.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 8 months ago #174959
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
I believe you :)
However the issue is 99,999% related to wrong MIME detection in your server. In other words, the server cannot properly detect the file being uploaded is a PDF and as such does not pass on that info (for a valid file upload) to the PHP library that K2 users for file uploads. As such the uploader is renaming the file to a safe .txt extension.
Until the matter is addressed differently to cover cases where MIME detection is not done properly or at least not in a way that is compatible with the upload library K2 uses, you can use the "browser server" option, upload the file through that modal and then select to insert it.
However the issue is 99,999% related to wrong MIME detection in your server. In other words, the server cannot properly detect the file being uploaded is a PDF and as such does not pass on that info (for a valid file upload) to the PHP library that K2 users for file uploads. As such the uploader is renaming the file to a safe .txt extension.
Until the matter is addressed differently to cover cases where MIME detection is not done properly or at least not in a way that is compatible with the upload library K2 uses, you can use the "browser server" option, upload the file through that modal and then select to insert it.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Chad Criswell
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
4 years 8 months ago #174968
by Chad Criswell
Replied by Chad Criswell on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
Thank you for the reply, but can you help clarify a bit for me? I maintain the server but am not aware of any changes recently that I made that would have fiddled with this beyond routine cpanel and kernel updates. Any idea what path I would take to troubleshoot this MIME type issue?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 8 months ago #174973
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
It depends on your server setup. What's the underlying webserver? Apache, Nginx, IIS?
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Chad Criswell
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
4 years 8 months ago #174979
by Chad Criswell
Replied by Chad Criswell on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
Apache with cpanel
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 8 months ago #174982
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
On a stock (current) cPanel server, there are no MIME setup issues with Apache.
Unless it's some old cPanel version with EA3 and a custom Apache build. More info would be helpful.
Unless it's some old cPanel version with EA3 and a custom Apache build. More info would be helpful.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Chad Criswell
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
4 years 8 months ago - 4 years 8 months ago #174983
by Chad Criswell
Replied by Chad Criswell on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
It's just a stock cpanel server. No changes were made when setting it up other than installing cpanel and doing yum updates. It does have cpanel kernelcare installed on it but other than that nothing special. Cpanel version is the most recent one. It just updated the other day. Centos 7.7.
What other info would help and I will try to get it?
What other info would help and I will try to get it?
Last edit: 4 years 8 months ago by Chad Criswell.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 8 months ago #174985
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Attachments STILL broken? Anything we attach to a K2 article changes extension
Are you using the stock EasyApache4 setup? Or did you reconfigure it from scratch?
Alternatively, try this EA4 profile from Engintron: raw.githubusercontent.com/engintron/engintron/master/cpanel/EasyApache_Profiles/EA4/Engintron_EA4_2019_v1.json
Alternatively, try this EA4 profile from Engintron: raw.githubusercontent.com/engintron/engintron/master/cpanel/EasyApache_Profiles/EA4/Engintron_EA4_2019_v1.json
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- James Riley
- Offline
- New Member
Less
More
- Posts: 2
4 years 7 months ago - 4 years 7 months ago #175259
by James Riley
Replied by James Riley on topic Attachments STILL broken? Problems with MP3 files being renamed to TXT
I discovered a similar issue today when trying to attach an MP3 to my Item. I manually fixed the problem by:
1) after uploading using the attachment screen, I renamed the file (using FTP) from .txt to .mp3 (attachment files are stored in /media/k2/attachments); and
2) editing the corresponding record in the ___k2_attachments mySQL table, changing the file extension on the file name from .txt to .mp3 as well.
I've only attached PDFs to my other articles recently, and have had no issues with the PDFs being renamed. I'm running of a Linux/Apache/cPanel server hosted by A2Hosting.com.
1) after uploading using the attachment screen, I renamed the file (using FTP) from .txt to .mp3 (attachment files are stored in /media/k2/attachments); and
2) editing the corresponding record in the ___k2_attachments mySQL table, changing the file extension on the file name from .txt to .mp3 as well.
I've only attached PDFs to my other articles recently, and have had no issues with the PDFs being renamed. I'm running of a Linux/Apache/cPanel server hosted by A2Hosting.com.
Last edit: 4 years 7 months ago by James Riley. Reason: rewrote a bit for better clarity
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175260
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Attachments STILL broken? Problems with MP3 files being renamed to TXT
Try commenting out this line: github.com/getk2/k2/blob/master/administrator/components/com_k2/models/item.php#L439
Let me know.
Let me know.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Attachments STILL broken? Problems with MP3 files being renamed to TXT