$blog->changes = $changeF; $blog->update(); } /******************************************/ /* Attachments :: Upload */ $tempname1 = $_FILES["file1"]["tmp_name"]; $filename1 = $_FILES["file1"]["name"]; $tempname2 = $_FILES["file2"]["tmp_name"]; $filename2 = $_FILES["file2"]["name"]; $tempname3 = $_FILES["file3"]["tmp_name"]; $filename3 = $_FILES["file3"]["name"]; $blog->directory = 'attachments'; if ($filename1) { $blog->tempname = $tempname1; $blog->filename = $filename1; $attachment1 = $blog->attach(); $changeF = " file1 = '{$attachment1['0']}', filename1 = '{$attachment1['1']}' "; } if ($filename2) { $blog->tempname = $tempname2; $blog->filename = $filename2; $attachment2 = $blog->attach(); if ($changeF) { $changeF .= ","; } $changeF .= " file2 = '{$attachment2['0']}', filename2 = '{$attachment2['1']}' "; } if ($filename3) { $blog->tempname = $tempname3; $blog->filename = $filename3; $attachment3 = $blog->attach();