Multiupload:
Achtung wichtig nichtmehr diesen MOD Installieren!!! Folgender Link ist die neue Version mit mehr Funktionen. http://www.4homepages.de/forum/index.php?topic=30831.msg162118#msg162118Edit: für den Multiupload mit imageresizer müsst ihr weiter unten nachschauen:
Hinweiß: Es handelt sich um zwei verschiedene Multiuploads, d. h. nur denjenigen MOD einbauen, den man benötigt. so hab jetzt mal nach langer langer zeit endlich mal geschafft den SWF upload in 4images zu integrieren.
der funktioniert im endefekt genau wie der hier:
http://www.4homepages.de/forum/index.php?topic=29719.0 der is aber um sonst:).
hier ist die demo des uploads:
http://demo.swfupload.org/v220/simpledemo/index.phpbei dem upload muss dennoch der admin die bilder freischalten, des kann ich dann doch nicht mit meinen kenntnissen.
wär nett wenn des vielleicht jemand für mich erledigen könnte.
1. also als erstes mal müsst ihr eure daten sichern.
dann ladet euch die multiupload.rar datei im anhang runter enpackt sie und ladet dann den multiupload Ordner in folgendes Verzeichnis:
root\includes\
2. Erstell in deinem root Ordner eine Datei mit dem Namen
multiupload.php
und füge folgendes ein:
<?php
// Code for to workaround the Flash Player Session Cookie bug
$MyData=$_POST['dbname'];
if (isset($_POST["PHPSESSID"])) {
session_id($_POST["PHPSESSID"]);
} else if (isset($_GET["PHPSESSID"])) {
session_id($_GET["PHPSESSID"]);
}
session_start();
// Check post_max_size (http://us3.php.net/manual/en/features.file-upload.php#73762)
$POST_MAX_SIZE = ini_get('post_max_size');
$unit = strtoupper(substr($POST_MAX_SIZE, -1));
$multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
if ((int)$_SERVER['CONTENT_LENGTH'] > $multiplier*(int)$POST_MAX_SIZE && $POST_MAX_SIZE) {
header("HTTP/1.1 500 Internal Server Error"); // This will trigger an uploadError event in SWFUpload
echo "POST exceeded maximum allowed size.";
exit(0);
}
// Settings
$save_path = dirname(__FILENAME__) . "".$MyData."";
// The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
$upload_name = "Filedata";
$max_file_size_in_bytes = 2147483647;
// 2GB in bytes
$extension_whitelist = array("jpg", "gif", "png");
// Allowed file extensions
$valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-';
// Characters allowed in the file name (in a Regular Expression format)
// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = "";
$file_extension = "";
$uploadErrors = array(
0=>"There is no error, the file uploaded successfully",
1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini",
2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form",
3=>"The uploaded file was only partially uploaded",
4=>"No file was uploaded",
6=>"Missing a temporary folder"
);
// Validate the upload
if (!isset($_FILES[$upload_name])) {
HandleError("No upload found in \$_FILES for " . $upload_name);
exit(0);
} else if (isset($_FILES[$upload_name]["error"]) && $_FILES[$upload_name]["error"] != 0) {
HandleError($uploadErrors[$_FILES[$upload_name]["error"]]);
exit(0);
} else if (!isset($_FILES[$upload_name]["tmp_name"]) || !@is_uploaded_file($_FILES[$upload_name]["tmp_name"])) {
HandleError("Upload failed is_uploaded_file test.");
exit(0);
} else if (!isset($_FILES[$upload_name]['name'])) {
HandleError("File has no name.");
exit(0);
}
// Validate the file size (Warning: the largest files supported by this code is 2GB)
$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
if (!$file_size || $file_size > $max_file_size_in_bytes) {
HandleError("File exceeds the maximum allowed size");
exit(0);
}
if ($file_size <= 0) {
HandleError("File size outside allowed lower bound");
exit(0);
}
// Validate file name (for our purposes we'll just remove invalid characters)
$file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
HandleError("Invalid file name");
exit(0);
}
// Validate that we won't over-write an existing file
if (file_exists($save_path . $file_name)) {
HandleError("File with this name already exists");
exit(0);
}
// Validate file extension
$path_info = pathinfo($_FILES[$upload_name]['name']);
$file_extension = $path_info["extension"];
$is_valid_extension = false;
foreach ($extension_whitelist as $extension) {
if (strcasecmp($file_extension, $extension) == 0) {
$is_valid_extension = true;
break;
}
}
if (!$is_valid_extension) {
HandleError("Invalid file extension");
exit(0);
}
// Validate file contents (extension and mime-type can't be trusted)
/*
Validating the file contents is OS and web server configuration dependant. Also, it may not be reliable.
See the comments on this page: http://us2.php.net/fileinfo
Also see http://72.14.253.104/search?q=cache:3YGZfcnKDrYJ:www.scanit.be/uploads/php-file-upload.pdf+php+file+command&hl=en&ct=clnk&cd=8&gl=us&client=firefox-a
which describes how a PHP script can be embedded within a GIF image file.
Therefore, no sample code will be provided here. Research the issue, decide how much security is
needed, and implement a solution that meets the need.
*/
// Process the file
/*
At this point we are ready to process the valid file. This sample code shows how to save the file. Other tasks
could be done such as creating an entry in a database or generating a thumbnail.
Depending on your server OS and needs you may need to set the Security Permissions on the file after it has
been saved.
*/
if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path.$file_name)) {
HandleError("File could not be saved.");
exit(0);
}
exit(0);
/* Handles the error output. This error message will be sent to the uploadSuccess event handler. The event handler
will have to check for any error messages and react as needed. */
function HandleError($message) {
echo $message;
}
?>3. öffne: root\templates\your templates\member_uploadform und such nach:
/<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="uploadbutton.disabled=true;">füge davor folgendes ein:
<!DOCTYPE html>
<html>
<head>
<title>SWFUpload Demos - Simple Demo</title>
<link href="{template_url}/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="includes/multiupload/swfupload/swfupload.js"></script>
<script type="text/javascript" src="includes/multiupload/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="includes/multiupload/js/fileprogress.js"></script>
<script type="text/javascript" src="includes/multiupload/js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
var settings = {
flash_url : "includes/multiupload/swfupload/swfupload.swf",
flash9_url : "includes/multiupload/swfupload/swfupload_fp9.swf",
upload_url: "multiupload.php",
post_params: {"PHPSESSID" : "<?php echo session_id(); ?>" ,
"dbname" : "/data/media/<?php echo $cat_id; ?>/" },
file_size_limit : "100 MB",
file_types : "*.*",
file_types_description : "All Files",
file_upload_limit : 999,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "includes/multiupload/images/hintergrund.png",
button_width: "195",
button_height: "29",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '<span class="theFont">Durchsuchen & Hochladen</span>',
button_text_style: ".theFont { font-size: 16; }",
button_text_left_padding: 12,
button_text_top_padding: 3,
// The event handler functions are defined in handlers.js
swfupload_preload_handler : preLoad,
swfupload_load_failed_handler : loadFailed,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete
// Queue plugin event
};
swfu = new SWFUpload(settings);
};
</script>
</head>
<body>
<div id="content">
<h2>Bilderupload</h2>
<form id="form1" action="index.php" method="post" enctype="multipart/form-data">
<span id="spanButtonPlaceHolder"></span>
<input id="btnCancel" type="button" value="Upload abbrechen" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px; backgroundcolor:: #0066ff;" />
</div>
<div id="divStatus">0 Dateien hochgeladen.</div>
<div>
<div class="fieldset flash" id="fsUploadProgress">
</div>
</form>3.1 such nach:
<input type="reset" value="{lang_reset}" class="button" />
</p>
</form>füge danach folgendes ein:
</div>
</body>
</html>4. offne: root\templates\your templates\style.css und füge am Schluss folgendes ein:
/*--Mutliupload-----------------------------------------------*/
/*--Mutliupload-----------------------------------------------*/
/* -- Form Styles ------------------------------- */
form {
margin: 0;
padding: 0;
}
div.fieldset {
border: 1px solid #afe14c;
margin: 10px 0;
padding: 20px 10px;
}
div.fieldset span.legend {
position: relative;
background-color: #FFF;
padding: 3px;
top: -30px;
color: #73b304;
}
div.flash {
width: 375px;
margin: 10px 5px;
border-color: #D9E4FF;
-moz-border-radius-topleft : 5px;
-webkit-border-top-left-radius : 5px;
-moz-border-radius-topright : 5px;
-webkit-border-top-right-radius : 5px;
-moz-border-radius-bottomleft : 5px;
-webkit-border-bottom-left-radius : 5px;
-moz-border-radius-bottomright : 5px;
-webkit-border-bottom-right-radius : 5px;
}
button,
input,
select,
textarea {
border-width: 1px;
margin-bottom: 10px;
padding: 2px 3px;
}
input[disabled]{ border: 1px solid #ccc } /* FF 2 Fix */
label {
width: 150px;
text-align: right;
display:block;
margin-right: 5px;
}
#btnSubmit { margin: 0 0 0 155px ; }
/* -- Table Styles ------------------------------- */
td {
vertical-align: top;
}
.progressWrapper {
width: 357px;
overflow: hidden;
}
.progressContainer {
margin: 5px;
padding: 4px;
border: solid 1px #E8E8E8;
background-color: #F7F7F7;
overflow: hidden;
}
/* Message */
.message {
margin: 1em 0;
padding: 10px 20px;
border: solid 1px #FFDD99;
background-color: #FFFFCC;
overflow: hidden;
}
/* Error */
.red {
border: solid 1px #B50000;
background-color: #FFEBEB;
}
/* Current */
.green {
border: solid 1px #DDF0DD;
background-color: #EBFFEB;
}
/* Complete */
.blue {
border: solid 1px #CEE2F2;
background-color: #F0F5FF;
}
.progressName {
color: #555;
width: 323px;
height: 14px;
text-align: left;
white-space: nowrap;
overflow: hidden;
}
.progressBarInProgress,
.progressBarComplete,
.progressBarError {
width: 0%;
height: 2px;
background-color: blue;
margin-top: 2px;
}
.progressBarComplete {
width: 100%;
background-color: green;
visibility: hidden;
}
.progressBarError {
width: 100%;
background-color: red;
visibility: hidden;
}
.progressBarStatus {
margin-top: 2px;
width: 337px;
font-family: Arial;
text-align: left;
white-space: nowrap;
}
a.progressCancel {
display: block;
height: 14px;
width: 14px;
background-image: url(../../includes/multiupload/images/cancelbutton.gif);
background-repeat: no-repeat;
background-position: -14px 0px;
float: right;
}
a.progressCancel:hover {
background-position: 0px 0px;
}
/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
vertical-align: top;
}jetzt seit ihr fertig. da das mein erster mod ist, entschuldige ich für fehler, die auftreten könnten.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------So hier noch ein anderer Multiupload mit imageresizer:1. Sicher deine Dateien. Dann erstell in deinem root Ordner eine Datei mit dem Namen
multiupload_2.php
und füge folgendes ein:
<?php
/* Note: This thumbnail creation script requires the GD PHP Extension.
If GD is not installed correctly PHP does not render this page correctly
and SWFUpload will get "stuck" never calling uploadSuccess or uploadError
*/
// Get the session Id passed from SWFUpload. We have to do this to work-around the Flash Player Cookie Bug
$uploadpath=$_POST['uploadpath'];
if (isset($_POST["PHPSESSID"])) {
session_id($_POST["PHPSESSID"]);
} else if (isset($_GET["PHPSESSID"])) {
session_id($_GET["PHPSESSID"]);
}
session_start();
ini_set("html_errors", "0");
// Check the upload
// Check the upload
if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
echo "ERROR:invalid upload";
exit(0);
}
if (!isset($_SESSION["file_info"])) {
$_SESSION["file_info"] = array();
}
$fileName = md5(rand()*10) . ".jpg";
move_uploaded_file($_FILES["Filedata"]["tmp_name"], "".$uploadpath."" . $_FILES['Filedata']['name']);
$file_id = md5(rand()*10000000);
$_SESSION["file_info"][$file_id] = $fileName;
echo "FILEID:" . $file_id;
// Return the file id to the script
?>2. lade dir die multiupload2.rar Datei runter, endpack sie und lade den Ordner multiuload2 in root\includes\ hoch.
3. öffne: root\templates\your templates\member_uploadform und suche:
<form method="post" action="{url_member}" enctype="multipart/form-data" onsubmit="uploadbutton.disabled=true;">füge davor folgendes ein:
<?php
session_start();
$_SESSION["file_info"] = array();
?>
<!DOCTYPE html>
<html>
<head>
<title>SWFUpload Demos - Resize Demo</title>
<link href="{template_url}/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./includes/multiupload2/swfupload/swfupload.js"></script>
<script type="text/javascript" src="./includes/multiupload2/js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function () {
swfu = new SWFUpload({
// Backend Settings
upload_url: "multiupload_2.php",
post_params: {"PHPSESSID": "<?php echo session_id(); ?>" ,
"uploadpath" : "data/media/<?php echo $cat_id; ?>/" },
// File Upload Settings
file_size_limit : "10 MB",
file_types : "*.jpg;*.png",
file_types_description : "JPG Images; PNG Image",
file_upload_limit : 0,
// Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
swfupload_preload_handler : preLoad,
swfupload_load_failed_handler : loadFailed,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
// Button Settings
button_image_url : "./includes/multiupload2/images/SmallSpyGlassWithTransperancy_17x18.png",
button_placeholder_id : "spanButtonPlaceholder",
button_width: 180,
button_height: 18,
button_text : '<span class="button">Select Images <span class="buttonSmall">(2 MB Max)</span></span>',
button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
button_text_top_padding: 0,
button_text_left_padding: 18,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
// Flash Settings
flash_url : "./includes/multiupload2/swfupload/swfupload.swf",
flash9_url : "./includes/multiupload2/swfupload/swfupload_fp9.swf",
custom_settings : {
upload_target : "divFileProgressContainer",
thumbnail_height: 800,
thumbnail_width: 800,
thumbnail_quality: 100
},
// Debug Settings
debug: false
});
};
</script>
</head>
<body>
<div id="content">
<h2>Multiupload</h2>
<form>
<div style="width: 180px; height: 18px; border: solid 1px #7FAAFF; background-color: #C5D9FF; padding: 2px;">
<span id="spanButtonPlaceholder"></span>
</div>
</form>
<div id="divFileProgressContainer" style="height: 75px;"></div>
3.1 such nach:
<input type="reset" value="{lang_reset}" class="button" />
</p>
</form>füg danach folgendes ein:
</div>
</body>
</html>3.2 such nach:
thumbnail_height: 800,
thumbnail_width: 800,
thumbnail_quality: 100hier kannst du die größe der Bilder eingeben, die du danach erhalten willst. In meinem Fall ist das 800x800.
4. offne: root\templates\your templates\style.css und füge am Schluss folgendes ein:
/*--Mutliupload-----------------------------------------------*/
/*--Mutliupload-----------------------------------------------*/
/* -- Form Styles ------------------------------- */
form {
margin: 0;
padding: 0;
}
div.fieldset {
border: 1px solid #afe14c;
margin: 10px 0;
padding: 20px 10px;
}
div.fieldset span.legend {
position: relative;
background-color: #FFF;
padding: 3px;
top: -30px;
color: #73b304;
}
div.flash {
width: 375px;
margin: 10px 5px;
border-color: #D9E4FF;
-moz-border-radius-topleft : 5px;
-webkit-border-top-left-radius : 5px;
-moz-border-radius-topright : 5px;
-webkit-border-top-right-radius : 5px;
-moz-border-radius-bottomleft : 5px;
-webkit-border-bottom-left-radius : 5px;
-moz-border-radius-bottomright : 5px;
-webkit-border-bottom-right-radius : 5px;
}
button,
input,
select,
textarea {
border-width: 1px;
margin-bottom: 10px;
padding: 2px 3px;
}
input[disabled]{ border: 1px solid #ccc } /* FF 2 Fix */
label {
width: 150px;
text-align: right;
display:block;
margin-right: 5px;
}
#btnSubmit { margin: 0 0 0 155px ; }
/* -- Table Styles ------------------------------- */
td {
vertical-align: top;
}
.progressWrapper {
width: 357px;
overflow: hidden;
}
.progressContainer {
margin: 5px;
padding: 4px;
border: solid 1px #E8E8E8;
background-color: #F7F7F7;
overflow: hidden;
}
/* Message */
.message {
margin: 1em 0;
padding: 10px 20px;
border: solid 1px #FFDD99;
background-color: #FFFFCC;
overflow: hidden;
}
/* Error */
.red {
border: solid 1px #B50000;
background-color: #FFEBEB;
}
/* Current */
.green {
border: solid 1px #DDF0DD;
background-color: #EBFFEB;
}
/* Complete */
.blue {
border: solid 1px #CEE2F2;
background-color: #F0F5FF;
}
.progressName {
font-weight: 700;
color: #555;
width: 323px;
height: 14px;
text-align: left;
white-space: nowrap;
overflow: hidden;
}
.progressBarInProgress,
.progressBarComplete,
.progressBarError {
font-size: 0;
width: 0%;
height: 2px;
background-color: blue;
margin-top: 2px;
}
.progressBarComplete {
width: 100%;
background-color: green;
visibility: hidden;
}
.progressBarError {
width: 100%;
background-color: red;
visibility: hidden;
}
.progressBarStatus {
margin-top: 2px;
width: 337px;
font-family: Arial;
text-align: left;
white-space: nowrap;
}
a.progressCancel {
font-size: 0;
display: block;
height: 14px;
width: 14px;
background-image: url(../images/cancelbutton.gif);
background-repeat: no-repeat;
background-position: -14px 0px;
float: right;
}
a.progressCancel:hover {
background-position: 0px 0px;
}
/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
vertical-align: top;
}
jetzt seit ihr fertig, viel Spaß damit.
zusätzlich würde ich noch diesen MOD empfelen:
http://www.4homepages.de/forum/index.php?topic=18564.0