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 .= "
"._MANAGEIMAGES."
"; if($imageupload) { $max_size = 1024*250; // the max. size for uploading if(isset($_POST['submit'])) { $multi_upload = new multi_upfiles; $multi_upload->upload_dir = STORIESPATH."/".USERUID."/images/"; // "files" is the folder for the uploaded files (you have to create this folder) $multi_upload->extensions = array(".png", ".gif", ".jpg", ".jpeg"); // specify the allowed extensions here $multi_upload->message[] = $multi_upload->extra_text(4); // a different standard message for multiple files //$multi_upload->rename_file = true; // set to "true" if you want to rename all files with a timestamp value $multi_upload->do_filename_check = "n"; // check filename ... $multi_upload->tmp_names_array = $_FILES['upfile']['tmp_name']; $multi_upload->names_array = $_FILES['upfile']['name']; $multi_upload->error_array = $_FILES['upfile']['error']; $multi_upload->replace = "n"; $multi_upload->upload_multi_files(); buildImageList( ); } if(isset($_GET['upload']) && !isset($_POST['submit'])) { $output .= "
"; for($x = 1; $x < 6; $x++) { $output .= "
"; } $output .= "
"; } else { if(isset($_GET['delete'])) { $folder = STORIESPATH."/".USERUID."/images"; $validFile = false; $directory = opendir($folder); while($filename = readdir($directory)) { if($filename == $_GET['delete']) $validFile = true; } if($validFile) { $success = unlink($folder ."/". $_GET['delete']); if($success) $output .= write_message(_ACTIONSUCCESSFUL); else $output .= write_error(_ERROR); } } $folder1 = STORIESPATH."/".USERUID.""; if(!file_exists($folder1)) { mkdir($folder1, 0755); chmod($folder1, 0777); } $folder = STORIESPATH."/".USERUID."/images"; if (!file_exists($folder)) { mkdir($folder, 0755); chmod($folder, 0777); } $directory = opendir("$folder"); $output .= "
"; $count = 0; while($filename = readdir($directory)) { if($filename=="." || $filename==".." || $filename == "imagelist.js") continue; list($imght, $imgwth, $type, $attr) = getimagesize("$folder/$filename"); $output .= ""; $count++; } if($count == 0) $output .= ""; $output .= "
"._FILENAME.""._IMAGECODE.""._OPTIONS."
$filename<img src=\"$folder/$filename\">"._VIEW." | "._DELETE."
"._NORESULTS."
"; $output .= write_message(""._UPLOADIMAGE.""); } } else { $output .= write_message(_NOTAUTHORIZED); } ?>