Restoring attached pictures

Started by Mareid, January 28, 2011, 09:42:58 PM

Previous topic - Next topic

Mareid

I had to remove my entire forum including all the files.  Before I did that, I did a backup.  Then I tried to install rc4 and then restore.  the install warned me that I needed to go an do the upgrade, so I just did the restore, and then the upgrade.  However the attachments were not restored.  I had a copy of the attachment directory so I just ftp'd that up...but it doesn't work

Looking at a topic I see a little attachment icon
opening the topc and mousing over the attachment link inside the topic I see something like

www.rockwell-family.net/forum/index.php?action=dlattach;topic=1570.1;attach=987

If I click on that it attempts to open the attachment with windows photo viewer which claims it's damaged, corrupted or too large.  Irfanview can't open the file in the filebackups that I did either.

Is there a way to re-link the attachments to the appropriate topics?  Did I mess it up by trying to install rc4 instead of reinstalling rc3 and then upgrading?  Should I start over with a clean install or is there a way to repair this?  Naturally I still have the .tar.gz file that smf created when I did the backup and I still have a copy of the attachment directory.

Mareid

I did the restore and upgrade from scratch, including having the attachements on the server when the upgrade took place. and it all went fine.  But the attachments didn't get re-attached.  Is that a bug, or is that just what happens when you do a restore?

kat

Quote from: mareid on January 28, 2011, 09:42:58 PMDid I mess it up by trying to install rc4 instead of reinstalling rc3 and then upgrading?

I'd assume that that's where you screwed it, I'm afraid. :(

I'd say restore your backup, check the attachments work, then upgrade to RC4.

Mareid

I did a clean install from the backup and a clean upgrade with no errors.  attachments are still not "attached".

kat

Is the path to your attachments directory, in Admin>Attachments and avatars>Attachment Settings correct?

Have you tried this?

http://docs.simplemachines.org/index.php?topic=663

Mareid

Well, the attachments are in forum/attachments and the avatars are fine.

When I did the original backup, only the database was backed up.  However when I did the brand new from scratch restore I also restored the directory structure and all the files that I had downloaded, including /forum/attachments.  All the files are there.  They have weird names like /public_html/forum/attachments/112_Family_Post_5_jpg20445d67a64e2f651cb3a7e40aa91443 and the server seems to think they are text files.

Oh, and I did run repair-settings.php and it's fine

kat

Hmmm... Tricky one, this.

Now, these are the things that I'd do, if that was my forum and it was in the state that yours is.

First, I'd try going to Admin>Forum Maintenance and try to Repair errors.

If that doesn't work, I'd try going to my site's CPanel and repairing the database.

Then, if that doesn't work, I'd be bamboozled and probably throw myself off a bridge. ;)

Mareid

ok tried both suggestions.  I had a large number of size errors which smf reported as being fixed, there were no db errors to fix.  I can browse the attachments directory in smf, but when I try to open an attachment (with Irfanview) I get one of several errors (Quantization Error) (invalid jpg file).  If I try to open the file within the posting the same thing happens, it appears to find something, but cannot display it.  the attachment appears as a link instead of an inline thumbnail.

kat

Oh, dear.

If Irfanview can't read them, they must've been corrupted, somehow.

UNLESS you have "Re-encode potentially dangerous image attachments" checked, in Admin.

I notice "Recode line endings in textual attachments", there, too.

I have no idea what that does, if it's checked, I have to confess.

Road Rash Jr.

When you save an attachement to SMF it encodes the file without an extention. SMF keeps track of this and knows what the file is supposed to be and renders it properly.
HOWEVER.....if you use an ftp program that treats files without extentions as ascii rather than binary it will corrupt the file you backup. So when you re-install or upload the backup, you are uploading a corrupted file and SMF has no idea what it is.
Perhaps this is your problem?
Never argue with an Idiot like myself, they just drag you down to their level then beat you with experience.

kat

That's the joy of Irfanview.

You don't need an extension for it to recognise a graphics file. ;)

If you load one into it, it tells you what the extension should be and asks you if you want to change it.

Road Rash Jr.

Thanks K@, I'll have to check this Irfanview out, it's new to me LOL
Never argue with an Idiot like myself, they just drag you down to their level then beat you with experience.

kat

It's one of the first things that I reinstall, if I have to reinstall the OS.

Dig under the hood.

It has many talents and it's free.

Mareid

Ahhhh R R that is exactly what happened.  Problem identified (not exactly solved, but at least I know what happened) and now I know what to do in the future!
I think we can mark this topic solved!

P.S.  Irfanview is terrific, and free.  I also like Textpad, if anyone cares.

kat

Lex pointed something out, in another thread.

If you use Filezilla, make sure the Transfer Type is set to "Binary", when you transfer the attachments.

Mareid

yep, that's exactly right.  Used filezilla and didn't know about the problem with binary files with no extension.  I know better now.  It's not a total disaster because the original posters have the pictures, but I wanted to solve the puzzle, and thanks to this community I've got my answer!

Arantor

Two things.

Firstly, there's a big sticky thread in the install help board about this very issue. Needs more exposure!!

Secondly, the 'recode line endings' is for text files only (or files that have .php, .txt, .xml and a bunch of other similar extensions) where it tries to convert the file into the right type, so if it's a Windows computer downloading it, it should be rewriting the line endings to suit Windows, and if it's Linux, it should be rewriting the file for Unixish line endings - in other words, quietly doing what the FTP thing does, except only on files it is reasonably sure are textual, and it's off by default because it became a PITA.

Advertisement: