Re: [PHPLIB] input type file: oohforms From: Kristian Köhntopp (kk <email protected>)
Date: 11/10/99

Bob Strouper wrote:
> But now if I follow your suggestion and save these files
> ( someplace ) before the actual DB insert is done, the script
> has to:
>
> 1) Remember which files it saved and where they are...
>
> 2) Then when all other form data passes validation , the
> script has to get the 'names' of files it saved in the TEMP
> location and ...
>
> 3) Reinsert those file 'names' into the query string which is
> generated from the form variables from the LAST
> HTTP_POST_VARS array and...
>
> 4) Move those files ( the files that originally passed the
> test when the others did not ) to a permanent location.

$validated = array();
$sess->register($validated);

$tempdir = sprintf("%s/%s", $_CONFIG["cachebase"], $sess->id);
if (!is_directory($tempdir))
  mkdir($tempdir, 0755);

reset($upload_files);
while(list($k, $v) = each($upload_files)) {
  if (validate_file($k) && copy($k, "$tempdir/$v")) {
    $validated[$v] = "yes";
  }
}

> ...And what is the correct way to tell oohforms to NOT include
> the variables (filenames that passed the test ) when
> calling load_defaults($elements_list)?

freeze() ?

Kristian

-- 
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.netuse.de/ (We have moved! Update your bookmarks!)
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.