Browse Source

Update api_documents.class.php

ptibogxiv 6 years ago
parent
commit
cf688a894b
1 changed files with 2 additions and 3 deletions
  1. 2 3
      htdocs/api/class/api_documents.class.php

+ 2 - 3
htdocs/api/class/api_documents.class.php

@@ -103,7 +103,7 @@ class Documents extends DolibarrApi
 		}
 
 		$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' );
 	}
 
 
@@ -224,10 +224,9 @@ class Documents extends DolibarrApi
 		}
 
 		$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)
 	 *