Ok so i can upload as many files as i see fit using
<input type=\"file\" name=\"image[]\">
<input type=\"file\" name=\"image[]\">
<input type=\"file\" name=\"image[]\">
HOWEVER My problem lies in the fact that each of these fields need to have a unique name, as i need to track and store these variables in the correct place.
Can i do multidimensional arrays from a html form or does anyone have any fantastic ideas as to what i could do about it? I have already tried this method :
<?
// this function works....
function upload($file,$pathtonewfile){
$temp = explode("/",$file);
$lastelement = count($temp) - 1;
$original_filename = $temp[$lastelement];
// and fouls up here
if (copy($file,$pathtonewfile)){
return true;
} else {
return false;
};
};
$path = "home/httpd/whatever/";
upload($image1,$path);
upload($image2,$path);
upload($fld_logo,$path);
?>
but really that method i feel is doomed to failure before iv even begun, so i need a new way....
The upload() function works, with the filename discovery (although messy) working, and yes, im sorry the input boxes need to be tracked so do need to be uniquely named.
Yes, i know that when a form uploads files, you get:
$file
$file_name
but my form (below) is failing to upload the files.
<?
<form name=\"upload\" method=\"post\" enctype=\"multipart/form-data\" action=\"$PHP_SELF\">
<input type=\"file\" name=\"image1\">
<input type=\"file\" name=\"image2\">
<input type=\"file\" name=\"logo\">
<input type=\"submit\" name=\"submit\" value=\"Upload\">
</form>
?>
Come on then pro's, fix that one 🙂