Keyword

Category image upload doesn't work - renames to ".txt"!?

  • Magnus Ehinger
  • Magnus Ehinger's Avatar Topic Author
  • Offline
  • New Member
More
14 years 4 months ago #83128 by Magnus Ehinger
Hello,I have a strange problem. I want to show a different image for each sub-category, so I uploaded an image in the category editor. The image seems to upload OK, but doesn't display correctly. When I FTP'd to my site, I noticed the image file has uploaded as "2.png.txt". What's going on here? Why does K2 change the suffix of the file to ".txt"??I'm using the following setup:K2 v2.2PHP 5.2.10Apache/1.3.41Joomla v1.5.9(MacOSX 10.6.3, Firefox 3.6.3)Cheers,  /Magnus

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

More
13 years 11 months ago #83129 by Doc Chaos
I don't recommend what you have done, that check is needed so no one can upload a file without an extension or a dangerous script. The block allowing png uploads is a few hundred lines before that. What you really need to do is find out why the .png is being stripped off the end of your file ... does the file have a .png file extension on your desktop, just a thought? - it does happen o.O - most upload scripts remove it while processing and then put it back, maybe it lost the $variable during the process ... that is what I'm guessing might be happening to you but I didn't actually go digging through the code I just took a quick peak so I really don't know. For security reasons I recommend you put that back until you know for sure or you feel comfortable with leaving your doors wide open while you run out shopping ...



... whats your address again ;P

Alex Delucca said:I found the error source. It happens only if you upload PNG files, i tried with JPG and it did not attach ".txt" to it. in administrator/components/com_k2/lib/class.upload.php on line 3122 if you replace '.txt' with '' it works with png too...

This code section renames dangerous scripts to .txt... i just don't understand why he identifies PNG files as dangerous scripts?! BUG?

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


Powered by Kunena Forum