In the code below, I am using the Upload class from verot.net/php_class_upload.htm. I can't get $q->update_single_field(etc) to run, and I suspect it has to do with there being a period in the string and something that ought to be done with quotations, but I can't figure it out. That method has worked fine in other contexts, and it also works if I replace the variable with a literal string.
if ($_FILES['cover']['name']) {
$f = new Upload($_FILES['cover']);
if ($f->uploaded) {
$f->Process('/home/intuitodev/public_html/plish/images/covers');
if ($f->processed) {
$uploaded_cover = $f->file_dst_name;
$q->update_single_field('publications',$pub_id,'publication_cover',$uploaded_cover);
echo '<br />Pub ID: '.$pub_id;
echo '<br />Uploaded Cover: '.$uploaded_cover;
} else {
echo 'error : ' . $f->error;
}
}
}
FYI, here is the method I use for updating. It works fine on anything other than that file variable:
function update_single_field($table,$row,$field,$data) {
$stmt = $this->pdo->prepare("UPDATE {$table} SET {$field} = :data WHERE id = :id");
$stmt->execute(array(':data'=>$data,':id'=>$row));
}
Thanks!