Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Nichole Knight   on Jun 11 In Java Category.

  
Question Answered By: Gorkem Yilmaz   on Jun 11

> from a server  to local  machine when the form  is being submitted.I
> have no idea  about it.The code  can be in any web  Technologies
> (JSP,Servlet,Cold Fusion).If u have any idea send me in reply.

<?php

if (isset($_POST['filename']) )
{
$downloadfile=$_POST['filename'];

include($downloadfile);

}
else {
include('reject.php');
}

?>

that is one way, however include will display the file, probably not what you
want. this is probbaly better:

<?php
header("Content-Disposition: attachment; filename=" . $downloadfile);
$datafile = fopen("$downloadfile","r");
$data = fread($datafile, 1000000);
echo $data;
?>

You will of course have to add a loop os that $data become $data = $data + more
read data.

Share: 

 
 
Didn't find what you were looking for? Find more on Query in downloading from server Or get search suggestion and latest updates.


Tagged: