Hello!
I have this piece of code to upload files:
[code]
//begin upload 1
//checks if file exists
if ($img1_name == "") {
$log .= "<br>No file selected for upload 1<br>";
}
if ($img1_name != "") {
//checks if file exists
//checks if files to big
if (($sizelim == "yes") && ($img1_size > $size)) {
$log .= "Archivo muy grande";
} else {
$img1_name = strtolower($img1_name);
$img1_name = ereg_replace( " ", "", $img1_name);
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
@copy($img1, "$abpath/$img1_name") or $log .= "No se pudo copiar la imagen al servidor<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "weeeeeee";
}
} else {
$log .= "File 1 is not an image<br>";
}
}
}
echo $log;
[code]
Which works cool, but if I want to make a function - function upload($imagename) - doesn't work.
What I'm doing is the following: input to choose how many image are you going to upload.
Then
code:
$num = 1;
while ($num <= $imgq ) {
echo "imagen #".$num." <input type=file name=img".$num." size=30><br>";
$num++;
}
Prints the inputs file depending on how many images he choose, and I want to make the upload function above to work as many times as images are upload or choosen, I can do it with only one image, but when I try to make it a functio to then make a while to porccess all the image, it doesn't work.
What I have now is:
function upload($img1){
code above
}
upload ($imagen1);
Of course, I changed the input file name to imagen".$num."
error: No file selected for upload 1
That means that $img1_name == ""
Anybody has time to take a look?
Thanks in advance!
Wakkos
follow the white rabbit