File download script works but gives invalid file.

Hello,

I was hoping if you guys could help me with an issue im experiencing in my php download script i downloaded from a website.

I just pass the name of the file like this a href="download_file.php?f=picture2.jpg">Download picture2</a>
where f is the Get variable
it does download the image but i can not open it
same with word document they unreadable
same with pdf file, adobe tell me its invalid format

take a look at the code:
http://pastebin.com/PxU4LUGz

I think its using the wrong header

what you guys think?

Thanks in advance

Hi,

If you look really closely at the image, could it be you’re sending new headers or stuff like that?
( so that viewers and operating systems that look at fileheaders don’t understand what they’re being handed )

I suspect there is a ‘dir’ being printed somewhere.

Good luck!
O.

Hello,

Hi I didnt make the script but i know what it does line by line.

using the Get super global it gets the name and extension of the file and then look that file in the assigned source path and then it use headers to force download but they files can’t be used when i download it idk if the headers are wrong or not

Thanks replaying

Sponsor our Newsletter | Privacy Policy | Terms of Service