News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Attachments and avatars corrupt

Started by xdakotax, August 12, 2011, 06:26:16 PM

Previous topic - Next topic

xdakotax

Hi guys,

I need some help. I have come to my forum today and all the attachments and avatars seem to be corrupt.
When you download a .zip it says the archive has come to an unexpected end, with images the thumbnails no longer show, and when downloading images it allows to save the image but upon opening the file is unreadable.

On the FTP the files are named very strangely (although don't know if this is by default), things like:

19_1_JPG_thumb483065b19002671bb19dcdfcd9c5df62
27_geupkgucsj_jpg_thumbdcbb47fa58ad8401d4e88da680190489

The FTP attachments folder is showing over 1000 files but my forum is only reading 400.

Am I totally screwed here, or is there a way to recover anything?
Unfortunately I do not have a backup, due to my drive crashing last week (always the way, typical).

Your help would be greatly received, thank you in advance!

Angelina Belle

Do the avatars look OK on the forum? Are the attachments OK on the forum?

It is normal for the files to have funny names. SMF does that so they'll have unique names.

If you download them directly, using ftp, you can run into two problems
1) If you use ASCII file transfer type, the downloaded file will be all messed up.  You must use type "I" or "img", rather than ascii
2) If you want to see a JPG as a JPG, you'll need to give it a .JPG file type.

You will find that, in addition to attachments, uploaded avatars are also in the attachments directory.  This will "pump up" your count. Furthermore, you might find that, for some avatars, there is more than one file with the same number associated.

So you are bound to have more files in the folder than you have actual attachments.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

xdakotax

Hi Angelina,

I have still been unable to solve this problem. I have very patient forum users who are having to use email to shares files until I fix this.

If an attachment happens to be an image it displays the error "image cannot be shown because it contains errors" - the image names are all intact in the attachments file maintenance area in the admin.

If I download the files manually (binary) and then manually add an extension they work fine when I open them. They are just failing to link up as attachments through SMF.

Can anyone help? I have tried repairing tables and this hasn't worked at all.

Angelina Belle

I'm surprised you left it so long!

I'm not sure what is going on.  I'm not sure what the issue is with archives and zips.
You have a problem when you add a new attachment?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

MrPhil

Were the attachment files transferred to another computer at some point? If they were FTP'd in the wrong mode (ASCII/TEXT instead of binary/image) at any stage, they've been irreversibly corrupted. I hope you have some backups of them in that case! Images and zip files will suffer severe damage if transferred as human readable text, and transferring them back won't fix the damage.

xdakotax

Hi guys, thanks for the replies.

The behavior still occurs on newly added attachments. I haven't manually transferred the files but starting to wonder if this is something the webhost has done! :(
Irreversibly corrupt isn't good news as it's 7 years worth of data submitted by various users. Of course, as I am unable to tell when the problem happened I can't even instruct the host to do a backup restore as it was at least a year ago.

What I find strange is the attachments are intact if I manually download them and mess with file extensions, so does this mean they are corrupt?

Thanks and I appreciate your time.

Angelina Belle

It sounds as though the files themselves are not corrupted.  They contain all the right bits.  The problem is that they are not served up properly.  I cannot know why.  It sounds, offhand, like a MIME problem, but I don't know much about the guts of the attachment system.  I bet Mr.Phil knows a good deal more than I know.

What mods do you have installed?
Any other customizations?

Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

xdakotax

Once again Angelina I appreciate you coming back to me.
The forum is completely clean even a default theme, just one day this area stopped working.... I'm sorry I can't be more technical than that.
I'm wondering if I should try and setup a sub forum and import the data to see if a secondary more updated setup corrects the problem. Or do you think this will make matters worse?

MrPhil

I would ask your host if they've made any server changes at around the time the trouble started. If the files can be downloaded manually and renamed, and work, then it sounds like the original files are OK. You do back up not only the database but also at least the attachments and avatars once in a while, right?

Your host may have changed something on the server such that certain file types are being corrupted by being sent in a different "MIME type" than they were before. Is your forum showing, say, a JPEG image as .jpg extension, or is it something else? If it's not an image extension, maybe something has gone wrong with SMF's handling of these files. Have you made any changes to your .htaccess file, that may be telling the server the wrong way to deliver a given file?

Angelina Belle

It is very strange, on a bare-bones SMF installation, to have this problem.
And now you say the images on your theme are messed up, also?

Can we see a link to your forum?
We can run it through Rex Swain's header viewer and see what we can see.

Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Advertisement: