$photo_array = array($file1, $file2, $file3);
$flag_error = false;
foreach ($photo_array as $photo) {
if(!$photo || empty($photo) || !is_array($photo) ) {
// error: nothing uploaded or wrong argument usage
$this->errors[] = "Image was not uploaded";
$flag_error = true;
}elseif($photo['error'] != 0) {
// error: nothing uploaded or wrong argument usage
$this->errors[] = $this->upload_errors[$photo['error']];
$flag_error = true;
}/*else {
$i = 1;
$this->temp_path.$i = $photo['tmp_name'];
$this->filename.$i = $maxid.basename($photo['name']);
$i++;
} */
}
if ($flag_error) {
return false;
}elseif (!$flag_error) {
$this->temp_path1 = $file1['tmp_name'];
$this->filename1 = $maxid.basename($file1['name']);
$this->temp_path2 = $file2['tmp_name'];
$this->filename2 = $maxid.basename($file2['name']);
$this->temp_path3 = $file3['tmp_name'];
$this->filename3 = $maxid.basename($file3['name']);
$this->datecreate = strftime("%Y-%m-%d %H:%M:%S", time());
return true;
}
|