Can't get attachments to work (2.0.14)

Started by baranorama2, August 09, 2017, 02:03:05 PM

Previous topic - Next topic

baranorama2

Hi,

I can't get my attachments and avatars to work, ever since 2.0.13 something went wrong and I've been trying everything and nothing works. They were working normally before and I haven't added any packages or anything that could brake this.
Nothing was moved, copied, no permission changes.
Folders have writing permission, there are files in the folders.
I upload new attachments and when I download them they are corrupted. All that are already uploaded to forum don't work anymore.
Absolutely no error of any kind in error logs and all those check work fine.
I'm out of ideas what to try and what to check, I've been trying few things from different topics but nothing helped.

P.S. I edited index.php to forum.php but when updating to new version I did repack the updates to point to forum.php and all tests were successful

Illori


baranorama2

Quote from: Illori on August 09, 2017, 02:09:38 PM
does it work if you put index.php back?

Doesn't help, tried it again just now to be 100% sure.

Kindred

How are you downloading the attachments ?

How do you know they are corrupted?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

baranorama2

Quote from: Kindred on August 09, 2017, 06:26:13 PM
How are you downloading the attachments ?

How do you know they are corrupted?

I go to the post that has attachments and I click on one and after download I can't open it with any photo viewer, the file extension is correct .jpg or .png as well as the size of the file, it's matching to original file that I upload.

Even if I go to admin center and Forum - Attachments and Avatars and click on any of attachments a new window opens up that should display the attachments but it's empty, nothing shows up.

d3vcho

Do you have any mods installed? Does the rest of the users of your forum have the same issue?
"Greeting Death as an old friend, they departed this life as equals"

baranorama2

Quote from: d3vcho(); on August 10, 2017, 06:11:10 AM
Do you have any mods installed? Does the rest of the users of your forum have the same issue?

All of the users are experiencing this and it's not due to browser either.
I do have few mods installed but I think non of them has anything to do with attachments.
I even tried if it's theme issue, but it's not.

Illori

can you check if the attachments in the attachment folder can be opened at all? even without an extension you should be able to open them to verify the content.

baranorama2

Quote from: Illori on August 10, 2017, 10:23:36 AM
can you check if the attachments in the attachment folder can be opened at all? even without an extension you should be able to open them to verify the content.

Not sure what you mean exactly but when I open the folder of attachments they aren't in .jpg or .png format but after I download them by FTP and change to .png or .jpg I can open them and they work.

Hm, so they actually aren't corrupt  :o but can't be accessed through forum  :-\

shawnb61

Screenshots of the exact issue you are seeing might help. 

In your admin control panel, do all of your attachment & avatar folders & URLs look correct?   Are any of them blank?  If so, I'd consider double-checking all folders using repair_settings.php
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

baranorama2

Quote from: shawnb61 on August 11, 2017, 08:38:57 PM
Screenshots of the exact issue you are seeing might help. 

In your admin control panel, do all of your attachment & avatar folders & URLs look correct?   Are any of them blank?  If so, I'd consider double-checking all folders using repair_settings.php

checked and everything was set correctly as recommended suggested.

baranorama2

I figured out why attachments (jpg/png) don't work.

I downloaded one jpg and opened it in notepad++ and what I noticed is that there are 2 empty lines at top of document, and after simply deleting those 2 lines and saving it, the picture works. So something is adding empty lines and braking attachments?  ???

shawnb61

One possible source of inserted newlines is blank lines at the bottom of php files.  Even if the file is just included. 

I would look very carefully at any php source code you have had to edit, and make sure you haven't put a couple newlines at the bottom in your editor.  (It usually 'feels' right to put a line down there, but it can cause havoc in .php...) 

I would start with the files you KNOW you edited, like index.php/forum.php. 

This sounds similar, note in the last update the OP made he says he had to hunt around to find the offending file:
https://stackoverflow.com/questions/5760365/problem-with-inserted-newlines-in-downloaded-files-and-displayed-images-from-cak
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

baranorama2

Quote from: shawnb61 on August 12, 2017, 12:21:15 PM
One possible source of inserted newlines is blank lines at the bottom of php files.  Even if the file is just included. 

I would look very carefully at any php source code you have had to edit, and make sure you haven't put a couple newlines at the bottom in your editor.  (It usually 'feels' right to put a line down there, but it can cause havoc in .php...) 

I would start with the files you KNOW you edited, like index.php/forum.php. 

This sounds similar, note in the last update the OP made he says he had to hunt around to find the offending file:
https://stackoverflow.com/questions/5760365/problem-with-inserted-newlines-in-downloaded-files-and-displayed-images-from-cak [nofollow]

WOW, I did not deliberately put any blank lines anywhere but that was the cause, I did not notice it until you said it. The forum.php (index.php) had 2 new lines before code start and that was the cause, after removing those lines everything is back to normal. Finally :)
Thank you all, this is now fixed! :)

Advertisement: