I'm working on project that should create link to download xpi file.
T his is my php code to download file:
$fileName = 'file.xpi';
$size = filesize($fileName);
$fp = fopen($fileName, "rb");
$content = fread($fp, $size);
fclose($fp);
header("Content-length: ".$size);
header("Content-type: application/x-xpinstall");
header("Content-disposition: attachment; filename=".$fileName.";" );
echo $content;
This code work's fine, but the downloaded file is my problem.. when i run, Firefox show this error message:
This add-on could not be installed because it appears to be corrupt.
Both files (that one on server and that one downloaded) have the same information.
Sive : 14.7 MB (15,509,809 bytes)
Sive on Disk : 14.7 MB (15,511,552 bytes)
Sive : 14.7 MB (15,509,809 bytes)
Sive on Disk : 14.7 MB (15,511,552 bytes)
What should I do?
Open downloaded file in some kind of text editor like Notepad and check if there are not any plain text PHP-related errors at the beginning of the file.