I have my server running and there is this index.php file on it. i use this in php to send a file from my server
<?php
$filename = "Small.gif";
if(file_exists($filename)){
//Get file type and set it as Content Type
$finfo = finfo_open(FILEINFO_MIME_TYPE);
header('Content-Type: ' . finfo_file($finfo, $filename));
finfo_close($finfo);
//Use Content-Disposition: attachment to specify the filename
header('Content-Disposition: attachment; filename='.basename($filename));
//No cache
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
//Define file size
header('Content-Length: ' . filesize($filename));
ob_clean();
flush();
readfile($filename);
exit;
}
?>
so when i open it with a browser it starts downloading the file.
now i'm using a browser to download it.my question is that how could i recieve this file by a java code and save it on my disk.THANKS
Aucun commentaire:
Enregistrer un commentaire