Sign in to follow this  
Followers 0
spyrorocks

Force Download

10 posts in this topic

OK, this question is for guys who know a litle about web-based autoit.

Im trying to make my script popup the download screen to download a file, but the script does some processing first and the user cannot know the direct link to the file. This is what i got so far:

consolewrite("HTTP/1.1 200 OK" & @LF)
consolewrite("Content-Type: application/force-download" & @LF)
consolewrite('Content-Transfer-Encoding: Binary' & @LF);
consolewrite('Content-Length: '&filegetsize('hello.exe') &@LF);
consolewrite('Content-Disposition: attachment; filename="hello.exe"' & @LF & @LF)
consolewrite(binarystring(fileread("hello.exe")))

it pops up the download screen, saves it, but the downlaoded data is corruptred.

Any ideas what im doing wrong?

Share this post


Link to post
Share on other sites



What happens if you just use a regular HTML file? Maybe hello.exe is corrupted itself

Share this post


Link to post
Share on other sites

consolewrite(binarystring(fileread("hello.exe")))

the exe is already a binary string i believe, which autoit doesn't support raw, maybe try this

http://www.autoitscript.com/forum/index.php?showtopic=21815


Announceing a line of new Apple products: the iDontCare and the iSuck, with the code based off their iCrashtoHellAlot ox.10, with a new GUI based on a zebra, panda bear, coyote, lollipop, and a can of tuna.

Share this post


Link to post
Share on other sites

but it returns MZ, unless you know of a workaround?


Announceing a line of new Apple products: the iDontCare and the iSuck, with the code based off their iCrashtoHellAlot ox.10, with a new GUI based on a zebra, panda bear, coyote, lollipop, and a can of tuna.

Share this post


Link to post
Share on other sites

several questions...

1. Why can't the user know?

2. Why does it need to be forced?

3. Why can't the user know the direct link to the file?

All this is VERY suspicious, as in you are trying to do a nono .... as in trying to hijack someone's PC...

Could you explain the whole thing you are trying to do, and not just the part you are having trouble with?

Share this post


Link to post
Share on other sites

several questions...

1. Why can't the user know?

2. Why does it need to be forced?

3. Why can't the user know the direct link to the file?

All this is VERY suspicious, as in you are trying to do a nono .... as in trying to hijack someone's PC...

Could you explain the whole thing you are trying to do, and not just the part you are having trouble with?

If he wanted to hijack a pc, he would just probly use an INetGet. Lol.

Anyway, They'll be able to find the direct link anyway with any type of packet sniffer.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Set the mime type to application/octet-stream. It's common to do this in php for download redirectors.

header('Content-Type: application/octet-stream');
.

EDIT: sorry, i miss understood the problem.

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0