snip
> questions:
> 1. if file is not declared, what does the file elements holds?... i
> sometimes get null value, sometimes get "none"

I get following output with PHP4.0.4pl1 w/ Linux
(I set php.ini to store uploaded files info to $HTTP_UPLOAD_FILES.
You will get different output if you don't)

--------- OUTPUT - when files to upload are not specified ----------
Key = userfile, Val = Array

a.. Key = name, Val = Array
a.. Key = 0, Val =
a.. Key = 1, Val =
a.. Key = type, Val = Array
a.. Key = 0, Val = application/octet-stream
a.. Key = 1, Val = application/octet-stream
a.. Key = tmp_name, Val = Array
a.. Key = 0, Val = none
a.. Key = 1, Val = none
a.. Key = size, Val = Array
a.. Key = 0, Val = 0
a.. Key = 1, Val = 0
---------------------------------

--------- CODE - file_upload.php -----------
<html>
<head>
<title>File Upload Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
</head>

<body bgcolor="#FFFFFF">
<?php
// Data about Uploaded Files are stored in array in
$HTTP_POST_FILES["input_name"]
while(list($k,$v) = each($HTTP_POST_FILES)) {
 print("Key = $k,   Val = $v <br>\n");
 if (is_array($v)) {
  while(list($tk, $tv) = each($v)) {
   print("<li>Key = $tk, Val = $tv<br>\n");
   if (is_array($tv)) {
    while(list($ttk, $ttv) = each($tv)) {
     print("<li>Key = $ttk, Val = $ttv<br>\n");
    }
   }
  }
 }
}
?>

<form enctype="multipart/form-data" action="file_upload.php" method="post">
<input type="text" name"text" value="TEST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000">
<!-- Do any browsers care about MAX_FILE_SIZE? -->
Send this file: <input type="file" name="userfile[]">
Send this file: <input type="file" name="userfile[]">
<input type="submit" value="Send File">
</form>
</body>
</html>
-----------------------------------------------------------

> 2. does my logic works.. coz usually the file elements in the last form
> post will work.. but the previous will be corrupted.

I cannot understand what you mean well....

> 3. i try using file input elements as arrays.. meaning <input type=file
> name=filearr[x]>.. doesn't work?

See the code and output, it works. (at least when PHP stores uploaded file
info to $HTTP_UPLOAD_FILES. Does not work w/o it?)

> 4.anyone know how to  work around this... does anyone encounter problem
> like these before?

Did you copy temp file? It will be deleted.

Regards
--
Yasuo Ohgaki

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to