Skip to content

Commit

Permalink
Update api_documents.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Nov 8, 2018
1 parent 8727435 commit cf688a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions htdocs/api/class/api_documents.class.php
Expand Up @@ -103,7 +103,7 @@ public function index($module_part, $original_file='')
}

$file_content=file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content-type' => mime_content_type($original_file),'content'=>base64_encode($file_content), 'encoding'=>'base64' );
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64' );
}


Expand Down Expand Up @@ -224,10 +224,9 @@ public function builddoc($module_part, $original_file='', $doctemplate='', $lang
}

$file_content=file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64' );
}


/**
* Return the list of documents of a dedicated element (from its ID or Ref)
*
Expand Down

0 comments on commit cf688a8

Please sign in to comment.