Hi,

I have a problem storing more then 1 attachment at a time. It seems that
midgard is using the same location for all attachments, therefor it
overwrites the first file with the second in the blob directory.

This is how the blobs table looks after the update:


id ptable pid score name title location mimetype sitegroup author created
64 article 1184 0 photo_2 /tmp/phpYGHEKZ
6/4/d0e8849c0d0748586cec0b8f8fc39da4 0 1 2001-03-07 09:12:41 Edit Delete
63 article 1184 0 photo_1 /tmp/phpsMnDO1
6/4/d0e8849c0d0748586cec0b8f8fc39da4 0 1 2001-03-07 09:12:41 Edit Delete

Here is the code:
$i_art = mgd_get_article($id);
while (list($key,$value) = each($attachment)) {
   $blob_size = $attachment[$key]["size"];
   $blob_name = $attachment[$key]["name"];
   $blob_type = "";
   @$i_art->deleteattachment("$key");
   if(!$name) $name=$blob_name;
   $name = $key;
   $title = $attachment[$key]["title"];
   $blob = $title;
   if ($blob != "") {
      if($attid=$i_art->createattachment($name, $title, $blob_type)) {
         if(($srcfp=fopen($blob,"r")) &&
($attfp=$i_art->openattachment($name))) {
            if(fwrite($attfp,fread($srcfp,$blob_size))==$blob_size) {
               fclose($attfp); fclose($srcfp);
            }
        }
     }
  }
}

By the way: where is blob_type used for? Can I leave it blank? I do not want
my users to have to enter this.

I am using midgard 1.4 and php3.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to