I am using K2 for content managing. In order to upload files I had to set /media/k2 directory's and its subdirectories' to 775. So, of course the web site has been damaged because of www-data group settings. That is a really bad experience but taught me so much.
My directories' owner was zkanoca and gorup was www-data. I have deleted the whole files and directories and uploaded from backup. I have set CHMOD values to 755 for directories and 644 for files as recommended.
This error occurs when a user tries to upload a profile picture too. It adds the user profile image file name into database but does not upload the file to media/k2/user directory.
For the restored web site the owner is zkanoca and the group zkanoca.
Then I have entered FTP information to Global Configuration page in administrator panel.
I have tried to upload some files using Joomla's Media Manager, it resulted well with no problem.
But when I try to add some attachments to a K2 item, it says it has uploaded and lists them in a table but actually it does not upload. It just insert a new record to k2_attachments table but does not upload the file to /media/k2/attachments. When I click on the file link on front side of the site, a message shows up K2_FILE_DOES_NOT_EXIST. But in the upload process it does not give any error.
If I add attachment to an item using K2, it adds records to database but not uploads the file. Then if I upload manually it works.
Another funny thing, if I upload the file first and add it as attachment to an item, it gives the same error message above.
I want to know how to upload files to K2 items with FTP settings. Because as far as I see it uses HTTP not FTP for files to upload.
I have tried one more thing but it did not help neither. I have changed the attachments folder to another. Again it could not write the file into the directory. So this means there is something wrong with K2's procedures.