Database tmp name?

See all posts See thread Reply

Re: Database tmp name? new!
by David, 13 years, 6 months ago
I made one small change which was the following.

echo 'OK ' .$handle->file_dst_pathname;

Is that what you mean?

ps. I dont mind making a small donation for your time, providing we get this thing to work, it has me confused!Reply
Re: Database tmp name? new!
by colin, 13 years, 6 months ago
It should be something like this:

include('class.upload.php');

$files = array();
foreach ($_FILES['my_field'] as $k => $l) {
 foreach ($l as $i => $v) {
 if (!array_key_exists($i, $files))
   $files[$i] = array();
   $files[$i][$k] = $v;
 }
}      
foreach ($files as $file) {
  $handle = new Upload($file);
  if ($handle->uploaded) {
    $handle->Process("./");
    if ($handle->processed) {
      
      // it is only here you know that your upload has succeeded
      // so you can insert the filename in your database here
      $sql = "INSERT INTO photos (filename) ";
      $sql .= "VALUES ('".mysql_real_escape_string($handle->file_dst_pathname)."')";
      $x = mysql_query($sql) or die(mysql_error());

    } else {
      echo 'Error: ' . $handle->error;
    }
  } else {
    echo 'Error: ' . $handle->error;
  }
  unset($handle);
}
Reply