Error interpreting jpeg image when downloading

0

The error is as follows:

"(Error interpreting JPEG image file (Not a JPEG file: starts with 0x3c 0x70)"

And this is my script to download files:

//Extensión del archivo para elegir el mime type
switch ($ext) {
case 'pdf':
  $headerType = 'application/pdf';
  break;
case 'png':
  $headerType = 'image/png';
  break;
case 'jpg':
  $headerType = 'image/jpg';
  break;
case 'jpeg':
  $headerType = 'image/jpeg';
  break;
case 'gif':
  $headerType = 'image/gif';
  break;
case 'xls':
  $headerType = 'application/excel';
  break;
case 'doc':
  $headerType = 'application/msword';
  break;
default:
  $headerType = 'application/octet-stream';
  break;
}

header('Content-type: '.$headerType.'');

$fp = fopen("php://output", "w");
ftp_fget($conn_id,$fp,$value,FTP_BINARY, 0);

On my server if I can open it well, but when downloading it through the system, does this error occur to me, is it an error with mimeType or is it something else?

    
asked by Fernando Garcia 27.08.2018 в 20:21
source

0 answers