Jump to content

Archived

This topic is now archived and is closed to further replies.

Gruzin

Download with php

Recommended Posts

hi guys, hope you are doing well!
I need your help with a php download script (I've googled it, but...), so I don't know from where to start. can u please give me a good tutorial or some reference to read? Thanks in advance.

Share this post


Link to post
Share on other sites
So ummm what exactly do you mean?  Like a dynamic script that will hide a file's true location, or simply force a user to download something?

Share this post


Link to post
Share on other sites
well actually, I want the script to download something when page loads, any ideas how can I start writing that?

Share this post


Link to post
Share on other sites
I am trying to use google but it displays the results where I can DOWNLOAD other things  :) Can't find php DOWNLOAD tutorial...

Share this post


Link to post
Share on other sites
Hmm just found http://www.phpfreaks.com/forums/index.php/topic,95433.0.html bout to read thru it now...

Share this post


Link to post
Share on other sites
ok, thank u very much corbin, I'll try that. I've also found something on php.net :)

Share this post


Link to post
Share on other sites
I've found not much info :(
Here is the URL [url=http://ge.php.net/header]http://ge.php.net/header[/url]

Share this post


Link to post
Share on other sites
[code]<?php

header('Content-disposition: attachment');
readfile('/path/to/file.txt');

?>[/code][/code]

Share this post


Link to post
Share on other sites
[quote author=Jenk link=topic=107696.msg432573#msg432573 date=1158050314]
[code]<?php

header('Content-disposition: attachment');
readfile('/path/to/file.txt');

?>[/code][/code]
[/quote]

I need something like this: when user clicks on a link, I want to download the file without promting the user. The example above asks user download or not the file... Thanks anyway. Still I have no idea how to do that, any suggestions will be greatly appreciated.

Share this post


Link to post
Share on other sites
In a word - no. You cannot do that.

Just think of the security implications if web-devs could force the user to download whatever they want..

Share this post


Link to post
Share on other sites
ok, can I display the Alert in html code and not the browser Alert window? like when it asks save, open or cancel download? Thanks for your answers

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.