Welcome Guest, Not a member yet? Register   Sign In
Download File Bug: weird characters !
#1

[eluser]yannyannyann[/eluser]
Hi everyone,

I have a bug on my site, when user clicks my DOWNLOAD FILE button, the image, video or sound file doesn't get downloaded but the browser displays characters, here an extract :
Code:
�����JFIF���������;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ���C�     ���C    ���,�"�������������� �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz����������������������������������������������������������������������������������� �����

My code was working before on another server...

What could be the reason for that ?
#2

[eluser]cairo140[/eluser]
Looks like you may be sending out faulty headers. If the file downloads with the proper extension, and the end user still can't open it, post a reply, and we'll try to help you out.

You can force a download using PHP headers: How to Force Downloads
#3

[eluser]Thorpe Obazee[/eluser]
or you can use http://ellislab.com/codeigniter/user-gui...elper.html
#4

[eluser]yannyannyann[/eluser]
Indeed, I am using this method :

How to force download

I still get the same error.

to see it in action, go here to my site which has the bug and click in the sidebar on a wallpaper (NO SPAM, NO POPUP I promise)

I have this error with different MIME TYPES : mp3, jpg, mpg, flv, ....

THey were all working before! What could have happened ?
#5

[eluser]TheFuzzy0ne[/eluser]
My guess is that you're sending something out before the header is sent, be it a whitespace or something along those lines.
#6

[eluser]yannyannyann[/eluser]
As I didn't change the function :

Code:
function output_file($file, $name, $mime_type='')

wich is containing the headers, I do'nt know how I could get characters sent before :S
#7

[eluser]davidbehler[/eluser]
a simple
Code:
echo "some character";
or a whitespace before the <?php could be enough.

Firefox says the type of the content on your download site is "text/html"...sure you are sending the headers?
#8

[eluser]Dam1an[/eluser]
If you have any whitespace in your PHP files outside the <?php and ?> tags, it gets sent to the browser
Also, you might have an acho statement in your code somewhere?
#9

[eluser]yannyannyann[/eluser]
It happened to be that accidentally loaded another file in my download controler.
I don't remember how this code came here :-)

So in the end all good !

Thank you guys !




Theme © iAndrew 2016 - Forum software by © MyBB