diff --git a/ktapi/KTAPIFolder.inc.php b/ktapi/KTAPIFolder.inc.php index 4a669b9..2085307 100644 --- a/ktapi/KTAPIFolder.inc.php +++ b/ktapi/KTAPIFolder.inc.php @@ -443,6 +443,11 @@ class KTAPI_Folder extends KTAPI_FolderItem $filename = basename($filename); $documenttypeid = KTAPI::get_documenttypeid($documenttype); + if (PEAR::isError($documenttypeid)) + { + return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype); + } + $options = array( 'contents' => new KTFSFileLike($tempfilename), diff --git a/ktwebservice/webservice.php b/ktwebservice/webservice.php index 9ca45ff..21bf718 100644 --- a/ktwebservice/webservice.php +++ b/ktwebservice/webservice.php @@ -1418,7 +1418,7 @@ class KTWebService } // write to the temporary file - $fp=fopen($tempfilename, 'wt'); + $fp=fopen($tempfilename, 'wb'); if ($fp === false) { $response=array( @@ -1552,7 +1552,7 @@ class KTWebService } // write to the temporary file - $fp=fopen($tempfilename, 'wt'); + $fp=fopen($tempfilename, 'wb'); if ($fp === false) { $response=array( @@ -1678,7 +1678,7 @@ class KTWebService $oStorage =& KTStorageManagerUtil::getSingleton(); $filename = $oStorage->temporaryFile($document); - $fp=fopen($filename,'rt'); + $fp=fopen($filename,'rb'); if ($fp === false) { $response['message'] = 'The file is not in the storage system. Please contact an administrator!'; @@ -1824,7 +1824,7 @@ class KTWebService $oStorage =& KTStorageManagerUtil::getSingleton(); $filename = $oStorage->temporaryFile($document); - $fp=fopen($filename,'rt'); + $fp=fopen($filename,'rb'); if ($fp === false) { $response['message'] = 'The file is not in the storage system. Please contact an administrator!';