Hi,
I'm stuck with one problem and will appreciate your help greatly.
I have a html page that looks like this.
// $totalcount is a user given value so it can vary.
for ($i=0,$i<$totalcount,$i++){
echo <input type=file name=file[]>
echo <input type=hidden name=fpath[$i] value=$something >
}
After I upload, I try to catch the filename ( $file_name[$i] ) and the hidden value $fpath[$i], doing this.
for ($i=0,$i<$totalcount,$i++){
echo $file_name[$i]; // only the filename
echo $fpath[$i]
}
This routine has no problem when I upload a picture from the first <input type=file>, but not the second. That is, because [] always ignores an empty value, $file_name[0] will give me the file name from the second <input type=file> but $fpath[0] won't.
I tried this.
for ($i=0,$totalcount,$i++){
echo <input type=file name=file[$i]> //$i added inside $file[].
echo <input type=hidden name=fpath[$i] value=$something >
}
Then it gives the correct fpath[$i], but I can't catch the value of $file by neither $file_name[$i] or $file[$i]_name.
I see many sites that allow users to upload multiple files. So there must be a way.
Would you please share your experience with me? Thank you very much in advance.