i want to make a download link in my page, the user upload text file to the server,i want to download that files, plz help me i new to php,
You need to set up headers properly then print the file contents.
You need to get the mime type and file size, then set the correct headers before sending the file. Try this:
function sendFile($file) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
header('Content-type: ' . finfo_file($finfo, $file));
header('Content-length: ' . filesize($file));
$filename = basename($file);
header("Content-Disposition: attachment; filename='$filename'");
fpassthru($file);
finfo_close($finfo);
}