I have uploaded file to s3. after changing its name and adding a timestamp to name
The same code is working fine on local Linux server. but having issue on aws linux server
Code I have used to download file using streams
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.$fileName);
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . $size);
if (!($stream = fopen($response, 'r'))) {
throw new \Exception('Could not open stream for reading file: ['.$fileName.']');
}
// Check if the stream has more data to read
while (!feof($stream)) {
// Read 1024 bytes from the stream
echo fread($stream, 1024);
}
// Be sure to close the stream resource when you're done with it
fclose($stream);
If I have uploaded a jpg image. Then after downloading the same file gives an error.
Error interpreting JPEG image file (Not a JPEG file: starts with 0x0a 0xff)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire