$dir = '../../../files/other/'; $file_type = 'Other'; } } } $file_tags = str_replace('_', " ", $field); $multi_upload->upload_dir = $dir; $multi_upload->message[] = $multi_upload->extra_text(4); $multi_upload->do_filename_check = 'y'; $multi_upload->tmp_names_array = $_FILES['upload']['tmp_name']; $multi_upload->names_array = $_FILES['upload']['name']; $multi_upload->error_array = $_FILES['upload']['error']; $multi_upload->replace = isset($_POST['replace']) ? $_POST['replace'] : 'n'; $multi_upload->extensions = array('.png', '.jpg', '.gif', '.zip', '.mp3', '.pdf', '.exe', '.rar', '.swf', '.vcf', '.css', '.dmg', '.php', '.doc', '.xls', '.xml', '.eps', '.rtf', '.iso', '.psd', '.txt', '.ppt', '.mov', '.flv', '.avi', '.m4v', '.mp4', '.gz', '.bz2', '.tar', '.7z', '.svg', '.svgz', '.lzma', '.sig', '.sign', '.js', '.rb', '.ttf', '.html', '.phtml', '.flac', '.ogg', '.wav', '.mkv', '.pls', '.m4a', '.xspf', '.ogv'); $multi_upload->upload_multi_files(); if (lastword($multi_upload->show_error_string()) == 'uploaded.') { $sql = "file_name = '{$file_name}', file_extension = '{$file_ext}', file_type = '{$file_type}', tags = '{$file_tags}'"; $ok = safe_insert('pixie_files', $sql); if (!$ok) { $message = $lang['file_upload_error']; } else { $messageok = $multi_upload->show_error_string(); logme($messageok, 'no', 'folder'); safe_optimize('pixie_files'); safe_repair('pixie_files'); } } else { $message = $multi_upload->show_error_string(); } print $message; }
<body> <h3>(multiple) File upload script:</h3> <p>Max. filesize = <?php echo $max_size; ?> bytes. (each) </p> <form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size; ?> "> <label for="upload[]">File 1:</label> <input type="file" name="upload[]" size="30"><br> <label for="upload[]">File 2:</label> <input type="file" name="upload[]" size="30"><br> <label for="upload[]">File 3:</label> <input type="file" name="upload[]" size="30"><br> <!-- Add here more file fields if you need. --> Replace files? <input type="checkbox" name="replace" value="y"> <input type="submit" name="Submit" value="Submit"> </form> <p><?php echo $multi_upload->show_error_string(); ?> </p> </body> </html>
$foto_upload->x_max_thumb_size = 120; $foto_upload->y_max_thumb_size = 150; if (isset($_POST['Submit']) && $_POST['Submit'] == "Upload") { $foto_upload->the_temp_file = $_FILES['upload']['tmp_name']; $foto_upload->the_file = $_FILES['upload']['name']; $foto_upload->http_error = $_FILES['upload']['error']; $foto_upload->replace = isset($_POST['replace']) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true $foto_upload->do_filename_check = "n"; if ($foto_upload->upload()) { $foto_upload->process_image(false, true, 80); $foto_upload->message[] = "Processed foto: " . $foto_upload->file_copy . "!"; // "file_copy is the name of the foto" } } $error = $foto_upload->show_error_string(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Photo-upload form</title> <style type="text/css"> <!-- body { text-align:center; } label { margin:0;