News:

Wondering if this will always be free?  See why free is better.

Main Menu

Garbled Attachments

Started by Chris G., October 27, 2004, 09:34:47 PM

Previous topic - Next topic

Chris G.

I recently uploaded attachments to my new server, and whenever I click on an attachment (a GIF, more specifically), it comes up as a garbled text file!  This only occurs on the new server.  What could be wrong?

http://dhost.info/chris/forum

[Unknown]

Blank lines are being sent before the attachment data.

What version of PHP is this?  Have you edited many of your templates or source files?

-[Unknown]

Chris G.

PHP 4.3.9.

I've edited a bunch of templates and text files ;).  Nothing lethal, though: I know PHP.

[Unknown]

Quote from: chrisg0619 on October 28, 2004, 07:27:21 PM
PHP 4.3.9.

I've edited a bunch of templates and text files ;).  Nothing lethal, though: I know PHP.

Yes, but what can happen is simple and evil: blank lines.

Although this should be automatically cured in that version of PHP, if you have spaces or blank lines at the end of source files (like Subs.php) or templates (like index.template.php) they can, in cases, find their way into the attachments.

-[Unknown]

Chris G.


[Unknown]

Quote from: chrisg0619 on October 28, 2004, 07:30:34 PM
Just at the end?

That's often the problem.  Here, let's take a look at Display.php, shall we?

You should see this section of code in there:
// This is done to clear any output that was made before now. (would use ob_clean(), but that's PHP 4.2.0+...)
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();


As the comment explains, this is there to fix it... so.. can we try adding the following before it?

echo 'The buffer is ', ob_get_length(), ' bytes...'; die;

And see what it says...?  After that, take it back out and add below the section I quoted:

echo 'The buffer is now ', ob_get_length(), ' bytes...';die;

Any different?  Post the results here and maybe we can find out what's going wrong.

-[Unknown]

Chris G.

Are you talking about display.template.php?

[Unknown]

Quote from: chrisg0619 on October 28, 2004, 07:40:42 PM
Are you talking about display.template.php?

I am not.  I speak of Sources/Display.php.

-[Unknown]

Chris G.

Ah. Sources. Forgot to look there.

Chris G.

Before > "The buffer is bytes..."
After > "The buffer is now bytes..."

[Unknown]

Do the files in the attachments folder have extra spaces in them, then?

-[Unknown]

Chris G.

You mean the actual file names? No.

[Unknown]

Quote from: chrisg0619 on October 29, 2004, 06:15:48 PM
You mean the actual file names? No.

I meant, if you were to download the files, rename them appropriately, and try to open them... would they work then? (or is it the files themselves that are damaged?)

-[Unknown]

Advertisement: