language) {
case "de":
// add you translations here
break;
default:
$extra_msg[1] = "".$this->the_file."";
$extra_msg[2] = sprintf(_WRONGEXT, $this->wrong_extensions, $this->ext_string);
$extra_msg[3] = "".$this->the_file." "._IMAGETOOBIG;
$extra_msg[4] = _NOFILESSELECTED;
$extra_msg[5] = _BADFILENAMES."".implode(",", $this->bad_filenames)."";
}
return $extra_msg[$msg_num];
}
// some error (HTTP)reporting, change the messages or remove options if you like.
// this method checkes the number of files for upload
// this example works with one or more files
function count_files() {
foreach ($this->names_array as $test) {
if ($test != "") {
$this->number_of_files++;
}
}
if ($this->number_of_files > 0) {
return true;
} else {
return false;
}
}
function get_img_size($file) {
$img_size = getimagesize($file);
$this->x_size = $img_size[0];
$this->y_size = $img_size[1];
}
function upload_multi_files () {
global $output, $imageheight, $imagewidth;
$this->message = "";
if ($this->count_files()) {
foreach ($this->names_array as $key => $value) {
if ($value != "") {
$this->the_file = $value;
$new_name = $this->set_file_name();
$ext = $this->get_extension($new_name);
$validImage = true;
if($ext == ".jpg" || $ext == ".gif" || $ext == ".jpeg") {
$this->get_img_size($this->tmp_names_array[$key]);
if($this->x_size > $imageheight) {
$this->message[] = $this->extra_text(3);
$validImage = false;
}
else if($this->y_size > $imagewidth) {
$this->message[] = $this->extra_text(3);
$validImage = false;
}
}
if($validImage) {
if ($this->check_file_name($new_name)) {
if ($this->validateExtension()) {
$this->file_copy = $new_name;
$this->the_temp_file = $this->tmp_names_array[$key];
if (is_uploaded_file($this->the_temp_file)) {
if($this->move_upload($this->the_temp_file, $this->file_copy)) {
$this->message[] = $this->error_text($this->error_array[$key]);
if ($this->rename_file) $this->message[] = $this->error_text(16);
sleep(1); // wait a seconds to get an new timestamp (if rename is set)
} else {
$this->message[] = $this->extra_text(1);
$this->message[] = $this->error_text($this->error_array[$key]);
}
}
} else {
$this->wrong_extensions++;
}
} else {
$this->bad_filenames[] = $this->the_file;
}
}
}
}
if (count($this->bad_filenames) > 0) $this->message[] = $this->extra_text(5);
if ($this->wrong_extensions > 0) {
$this->show_extensions();
$this->message[] = $this->extra_text(2);
}
} else {
$this->message[] = $this->extra_text(3);
}
$output .= write_message(is_array($this->message) ? implode("
", $this->message) : _ERROR);
}
}
$output .= "
| "._FILENAME." | "._IMAGECODE." | "._OPTIONS." |
|---|---|---|
| $filename | <img src=\"$folder/$filename\"> | "._VIEW." | "._DELETE." |
| "._NORESULTS." | ||