Hey everyone.
This is some code I am using to handle uploads from a form. It works for some files but not others and I don't know why - what am I missing?
btw:
$filename is the field in the form for the file
$num_files is the number of files
$realdir is the directory to upload into
for ($z = 0; $z < $num_files; $z++) {
if ($filename_name[$z]) {
$tempmessage = "";
$finalname = stripslashes($filename_name[$z]);
$newfile = "$realdir$finalname";
$newfile = "$domain$user/$dir$finalname";
if (is_uploaded_file($filename[$z])) {
if (!copy($filename[$z],"$newfile"))
echo "Couldnt copy";
if (!unlink($filename[$z]))
echo "Couldnt delete"; }else
echo "Error during upload";
}
}
Thanks for any help - I've been staring at this code for hours now 🙂