i'm using the below code to download a file, which work's well but the problem is that the file extension is missing, even after stressful download . i have tried changing it to other MIME types, what could be the problem and how do i solve it ?
header('Content-Type: audio/mp3'); header("Content-Disposition: attachment; filename=$row"); header("Content-Length: ".filesize("$row$row")); $fp = fopen("$row$row", "r"); fpassthru($fp); fclose($fp);
NOTE: the values in the $row array are fine.
Just a shot in the dark here, could it be that the filename has a space in it? In that case you can try to add double quotes around the filename, there are reports about parts after a space being omitted (e.g. here: http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
Edit: As discussed in the comments, the headers did not return the extension, so adding the .mp3 extension manually in the back-end solves this problem.