Re: [PHP] smart auto download file

2011-05-31 Thread jean-baptiste verrey
it's made in JavaScript, by creating an iframe loading the file, but their
downloader might use something like a php file to force download such as
?php
$filePath='/var/wwwblablah.zip';
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=azipfile.zip');
readfile($filePath);
?

On 31 May 2011 18:02, Ali Asghar Toraby Parizy
aliasghar.tor...@gmail.comwrote:

 I want to build a web page for file auto download like cnet.download.
 A page that tells user Your download will begin in a moment... and
 after a few seconds download starts.
 How can I do that by php
 thanks for any help.

 --
 Ali Asghar Torabi

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] smart auto download file

2011-05-31 Thread Ali Asghar Toraby Parizy
Hi
thanks for your help jean
I've used this code before. But I want a little different thing.
I need to tell something to the user before starting download.
something like Your download will begin in a moment... . So header
couldn't help me. If I try to echo anything header doesn't work!

On Tue, May 31, 2011 at 10:01 PM, jean-baptiste verrey
jeanbaptiste.ver...@gmail.com wrote:
 it's made in JavaScript, by creating an iframe loading the file, but their
 downloader might use something like a php file to force download such as
 ?php
 $filePath='/var/wwwblablah.zip';
 header('Content-type: application/octet-stream');
 header('Content-Disposition: attachment; filename=azipfile.zip');
 readfile($filePath);
 ?

 On 31 May 2011 18:02, Ali Asghar Toraby Parizy aliasghar.tor...@gmail.com
 wrote:

 I want to build a web page for file auto download like cnet.download.
 A page that tells user Your download will begin in a moment... and
 after a few seconds download starts.
 How can I do that by php
 thanks for any help.

 --
 Ali Asghar Torabi

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php






-- 
Ali Asghar Torabi

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] smart auto download file

2011-05-31 Thread Ashley Sheridan
On Wed, 2011-06-01 at 00:08 +0430, Ali Asghar Toraby Parizy wrote:

 Hi
 thanks for your help jean
 I've used this code before. But I want a little different thing.
 I need to tell something to the user before starting download.
 something like Your download will begin in a moment... . So header
 couldn't help me. If I try to echo anything header doesn't work!
 
 On Tue, May 31, 2011 at 10:01 PM, jean-baptiste verrey
 jeanbaptiste.ver...@gmail.com wrote:
  it's made in JavaScript, by creating an iframe loading the file, but their
  downloader might use something like a php file to force download such as
  ?php
  $filePath='/var/wwwblablah.zip';
  header('Content-type: application/octet-stream');
  header('Content-Disposition: attachment; filename=azipfile.zip');
  readfile($filePath);
  ?
 
  On 31 May 2011 18:02, Ali Asghar Toraby Parizy aliasghar.tor...@gmail.com
  wrote:
 
  I want to build a web page for file auto download like cnet.download.
  A page that tells user Your download will begin in a moment... and
  after a few seconds download starts.
  How can I do that by php
  thanks for any help.
 
  --
  Ali Asghar Torabi
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 -- 
 Ali Asghar Torabi
 


That's why Jean mentioned the use of Javascript and an Iframe. You have
the iframe point to your PHP script, and the rest of the page is what
you use for your message, etc. The Iframe can be hidden with CSS, and it
will still issue the call to download the file.
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] smart auto download file

2011-05-31 Thread jean-baptiste verrey
gosh, I should have read before answering for the downloader thing.
BUT you actually need javascript if you want to do it.
You create an hidden iframe somewhere on your page, you give him the url of
your file and pop it is downloaded, and you need simply to use javascript
function setInterval to do that after a couple of seconds!

On 31 May 2011 20:38, Ali Asghar Toraby Parizy
aliasghar.tor...@gmail.comwrote:

 Hi
 thanks for your help jean
 I've used this code before. But I want a little different thing.
 I need to tell something to the user before starting download.
 something like Your download will begin in a moment... . So header
 couldn't help me. If I try to echo anything header doesn't work!

 On Tue, May 31, 2011 at 10:01 PM, jean-baptiste verrey
 jeanbaptiste.ver...@gmail.com wrote:
  it's made in JavaScript, by creating an iframe loading the file, but
 their
  downloader might use something like a php file to force download such as
  ?php
  $filePath='/var/wwwblablah.zip';
  header('Content-type: application/octet-stream');
  header('Content-Disposition: attachment; filename=azipfile.zip');
  readfile($filePath);
  ?
 
  On 31 May 2011 18:02, Ali Asghar Toraby Parizy 
 aliasghar.tor...@gmail.com
  wrote:
 
  I want to build a web page for file auto download like cnet.download.
  A page that tells user Your download will begin in a moment... and
  after a few seconds download starts.
  How can I do that by php
  thanks for any help.
 
  --
  Ali Asghar Torabi
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



 --
 Ali Asghar Torabi



Re: [PHP] smart auto download file

2011-05-31 Thread Stuart Dallas
On Tue, May 31, 2011 at 8:49 PM, jean-baptiste verrey 
jeanbaptiste.ver...@gmail.com wrote:

 gosh, I should have read before answering for the downloader thing.
 BUT you actually need javascript if you want to do it.
 You create an hidden iframe somewhere on your page, you give him the url of
 your file and pop it is downloaded, and you need simply to use javascript
 function setInterval to do that after a couple of seconds!


You do not need javascript to do this, or an iframe. Use a meta refresh tag.

http://en.wikipedia.org/wiki/Meta_refresh

Sometimes I miss the way the web was before javascript :/

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


On 31 May 2011 20:38, Ali Asghar Toraby Parizy
 aliasghar.tor...@gmail.comwrote:

  Hi
  thanks for your help jean
  I've used this code before. But I want a little different thing.
  I need to tell something to the user before starting download.
  something like Your download will begin in a moment... . So header
  couldn't help me. If I try to echo anything header doesn't work!
 
  On Tue, May 31, 2011 at 10:01 PM, jean-baptiste verrey
  jeanbaptiste.ver...@gmail.com wrote:
   it's made in JavaScript, by creating an iframe loading the file, but
  their
   downloader might use something like a php file to force download such
 as
   ?php
   $filePath='/var/wwwblablah.zip';
   header('Content-type: application/octet-stream');
   header('Content-Disposition: attachment; filename=azipfile.zip');
   readfile($filePath);
   ?
  
   On 31 May 2011 18:02, Ali Asghar Toraby Parizy 
  aliasghar.tor...@gmail.com
   wrote:
  
   I want to build a web page for file auto download like cnet.download.
   A page that tells user Your download will begin in a moment... and
   after a few seconds download starts.
   How can I do that by php
   thanks for any help.



Re: [PHP] smart auto download file

2011-05-31 Thread Geoff Shang

On Wed, 1 Jun 2011, Ali Asghar Toraby Parizy wrote:


I need to tell something to the user before starting download.
something like Your download will begin in a moment... . So header
couldn't help me. If I try to echo anything header doesn't work!


Couldn't you just do an HTML redirect?

  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
  html
  head
  titleFile Download/title
  meta http-equiv=REFRESH
  content=10;url=http://www.example.net/download;/HEAD

  BODY
  PYour download will start in a few seconds./P

  PIf your download fails to start automatically,
  A HREF=http://www.example.net/download;click here/A./P
  /BODY
  /HTML

Of course, this is the resulting HTML you want to produce (or something 
like it).  You'll obviously get PHP to echo the appropriate URL.


This approach has the benefit that it'll work on anything.  My prefered 
browser does not support javascript, so you look me out of your site if 
you use it.


Geoff.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php