Advertisement:

Author Topic: Can't get attachments to work (2.0.14)  (Read 625 times)

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Can't get attachments to work (2.0.14)
« on: August 09, 2017, 02:03:05 PM »
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

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 47,664
Re: Can't get attachments to work (2.0.14)
« Reply #1 on: August 09, 2017, 02:09:38 PM »
does it work if you put index.php back?

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #2 on: August 09, 2017, 02:14:14 PM »
does it work if you put index.php back?

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

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 54,911
  • Gender: Male
    • Kindred-999 on GitHub
Re: Can't get attachments to work (2.0.14)
« Reply #3 on: August 09, 2017, 06:26:13 PM »
How are you downloading the attachments ?

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

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #4 on: August 10, 2017, 05:45:46 AM »
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.

Offline d3vcho();

  • Localizer
  • SMF Hero
  • *
  • Posts: 2,096
  • Gender: Male
  • Be prepared for hell
    • d3vcho on GitHub
    • @SMF_ES on Twitter
Re: Can't get attachments to work (2.0.14)
« Reply #5 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?
Programmer (noun.)
A person who fixed a problem you don't know you have, in a way you don't understand.


¡Únete al canal IRC de SMF en español! #smf-es en Freenode
Sigue a @SMF_ES en Twitter para enterarte de todas las novedades de SMF

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #6 on: August 10, 2017, 10:11:24 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.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 47,664
Re: Can't get attachments to work (2.0.14)
« Reply #7 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.

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #8 on: August 10, 2017, 11:02: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  :-\

Offline shawnb61

  • Support Specialist
  • Full Member
  • *
  • Posts: 403
    • sbulen on GitHub
Re: Can't get attachments to work (2.0.14)
« Reply #9 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
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #10 on: August 12, 2017, 05:15:42 AM »
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.

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #11 on: August 12, 2017, 05:21:57 AM »
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?  ???

Offline shawnb61

  • Support Specialist
  • Full Member
  • *
  • Posts: 403
    • sbulen on GitHub
Re: Can't get attachments to work (2.0.14)
« Reply #12 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
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Offline baranorama2

  • Semi-Newbie
  • *
  • Posts: 10
Re: Can't get attachments to work (2.0.14)
« Reply #13 on: August 12, 2017, 01:54:35 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! :)