Hello,

I'm trying to upload an image into an HIS (Hyperwave Information Server)
5.5 server running under Debian GNU/Linux (i386) with this userland
function :

,----
| function his_upload($datei, $parent, $attribute) {
|   /* datei : filename on the local (server) filesystem
|    * parent : parent collection of the document to upload
|    * attribute : string containing all the attributes, separated by \n
|    *
|    * Returns the new ObjID on success, false on error
|    */
|   global $hwconnector;
| 
|   $document_size = filesize($datei);
|   echo "[his_upload] $datei is $document_size long<br>";
|   $fd = fopen($datei, "r");
|   $document_data = fread($fd, $document_size);
|   fclose($fd);
|   echo "[his_upload] $datei : ".strlen($document_data)." read.<br>";
| 
|   $object_record = hw_array2objrec($attribute);
|   echo "[his_upload] object record preview :<br>".
|         nl2br($object_record)."<br>";
|   $hw_doc = hw_new_document($object_record, $document_data,
|         $document_size);
|   echo "[his_upload] hw_new_document : $hw_doc (last hw error msg: ".
|         hw_ErrorMsg($hwconnector).")<br>";
|   $result = hw_InsertDocument($hwconnector, his_get_objectID($parent),
|         $hw_doc);
|   echo "[his_upload] hw_insert_document returned $result (last hw ".
|         "error msg: ".hw_ErrorMsg($hwconnector).".)<br>";
|   return $result;
| }
| 
| function his_get_objectID($name)
| {
|     global $hwconnector ;
|     if (!$hwconnector)    return "-1"; // no connection to HIS
| 
|     if (!$name)   return "0" ;
|     $objids = hw_getobjectbyquery($hwconnector, "Name=$name" , -1);
|     if (count($objids) == 0) {
|       return "-2" ; // error! file not found in HIS
|     } else   return $objids[0] ;
| }
`----

When I try to use this function in a script, I get the following message :

,----[ PHP Ouput ]
| [his_upload] /tmp/php8JPPJW is 26264 long
| [his_upload] /tmp/php8JPPJW : 26264 read.
| [his_upload] object record preview :
| Type=Document
| DocumentType=Image
| MimeType=image/jpeg
| Name=~jhausser/pw/ebc/image
| 
| [his_upload] hw_new_document : 3 (last hw error msg: No error)
| Added str to header: Name=~jhausser/pw/ebc (21)
| Sending msg: type = 9 -- id = 6
| Recv msg: type = 9 -- id = 6
| Added str to header: Type=Document DocumentType=Image
| MimeType=image/jpeg Name=~jhausser/pw/ebc/image (81)
| Added str to header: Parent=0x7b (11)
| Sending msg: type = 32 -- id = 7
| Recv msg: type = 32 -- id = 7
| [his_upload] hw_insert_document returned (last hw error msg: Unknown
| error: -5.)
`----

And nothing is uploaded in Hyperwave...

Apache is compiled from source (tried versions 1.3.14 and 1.3.23) using
this configure command line :
./configure --prefix=/usr/local/apache --enable-module=so
--with-port=8080 --server-uid=www-data --server-gid=www-data

PHP is also compiled from source (tried versions 4.0.3, 4.1.1 and
4.2.1, same result) with the following configure command-line :
./configure --prefix=/usr/local/apache
--sysconfdir=/usr/local/apache/conf
--with-apxs=/usr/local/apache/bin/apxs --enable-safe-mode
--enable-magic-quotes --enable-ftp --with-hyperwave --with-mysql
--enable-trans-sid --enable-sockets --with-regexp=system

But what is astonishing is that the very same script runs under FreeBSD
4.2 (same Apache and PHP source archive, same configure options, with
Hyperwave's linux binairies running thanks to FreeBSD's compatibility
libraries), and I'm using the very same httpd.conf and php.ini on Linux
and FreeBSD !

I've been looking on PHP's changelog, google, phpbuilder's forums, PHP
mail archives and so on without finding anything about that 'Unknown
Error -5' and I'm running out of ideas... so any advice on the problem
would be really welcomed.

Thanking you in advance,

-- 
 Jean HAUSSER

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to