Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - auftrip

Pages: [1]
1
Multiupload:

Hier ist jetzt eine verbesserte Version des Multiuploads http://www.4homepages.de/forum/index.php?topic=30224.0, den ich schonmal gepostet hab.

Der upload verkleinert die ausgewählten Bilder auf die gewünschte Größe bevor die Dateien hochgeladen werden, d. h. die user brauchen nicht mehr solage um ein Bild hochzuladen, da diese schon vor dem upload eine kleinere Dateigröße besitzen.


Fogende Verbesserungen: Es werden automatisch Thumbnails beim Hochladen erstellt und die Bild, Thumbnail, Größen, etc. können jetzt übers Admin Kontrolpanel eingestellt werden. Desweiteren kann man einstellen, ob die Bilder gleich direkt freigeschaltet werden , oder ob sie im Admin Kontrolpanel angezeigt werden, um freigeschaltet zu werden.


1.    Entpacke den Ordner multiupload2 von der rar Datei des Anhangs in folgendes Verzeichnis:
   includes/
        somit ergibt sich dann folgendes Verzeichnis:
        includes/multiupload2

2.   Erstelle ein neues html Dokument mit dem Namen member_multiuploadform.html in folgendes       
        Verzeichnis:
   templates/your templates/

2.1   Füge folgenden code in das member_multiuploadform.html ein:

Code: [Select]
<?php
session_start();
$_SESSION["file_info"] = array();
?>

<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(); ?>" ,
"user_id" : "{user_id_upload_multi}" ,
"max_thumb_height" : "{max_thumb2_height}" ,
"max_thumb_width" : "{max_thumb2_width}" ,
"auto_thumbnail_quality" : "{auto_thumbnail2_quality}" ,
"thumbnail_proportions" : "{thumbnail_proportions}" ,
"direct_upload" : "{direct_upload}" ,
"cat_id" : "<?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,
queue_complete_handler : queueComplete,

// Button Settings
button_image_url : "./includes/multiupload2/images/SmallSpyGlassWithTransperancy_17x18.png",
button_placeholder_id : "spanButtonPlaceholder",
button_width: 200,
button_height: 18,
button_text : '<span class="button">Durchsuchen &amp; Hochladen</span>',
button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 15pt; } .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",
max_image_height: "{max_image2_height}",
max_image_width: "{max_image2_width}",
image_quality: "{image_multi_quality}",
cat_id: "<?php echo $cat_id?>",
direct_upload: "{direct_upload}"
},

// Debug Settings
debug: false
});
};
</script>
<div id="content">
<br />
  <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td valign="top" class="head1">
        <table width="100%" border="0" bordercolor="#0066ff" cellpadding="4" cellspacing="0">
          <tr>
            <td colspan="2" valign="top" class="head1">{lang_user_upload_multi}</td>
          </tr>
          <tr>
            <td width="50%" class="row1"><b>{lang_user_current_cat}</b></td>
            <td width="50%" class="row1"><div style="padding-left: 6px;"><b>{cat_name}</b></div></td>
          </tr>
          <tr>
          <form onsubmit="if (cat_id.options[cat_id.selectedIndex].value==0){ alert('{cat_name_required}'); return false;};" method="get" name="jumpbox" action="{url_member}">
            <td width="50%" class="row2"><b>{lang_user_upload_multi_other_cat}</b></td>
            <td width="50%" class="row2"><input type="hidden" name="action" value="multiuploadform">{upload_dropdown_multi}<input type="submit" value="{lang_go}" class="button" /></td>
          </form>
          </tr>
          <tr>
          <form>
            <td colspan="2" class="row1"><div align="center"><div style="width: 200px; height: 22px; border: solid 1px #7FAAFF; background-color: #C5D9FF; padding: 2px;"><span id="spanButtonPlaceholder"></span></div></div></td>
      </form>
          </tr>
          <tr>
          <td colspan="2" class="row2"><div align="center"><div id="divFileProgressContainer"></div></div></td>
      </tr>
          <tr>          
          <td colspan="2" class="row1"><div align="center"><div id="divStatus"></div></div></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
<br />
<div id="thumbnails" style="width: 800px;">
<?php
// Read the files from the saved images folder
$dir = new DirectoryIterator("data/thumbnails/$cat_id");
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot() && $fileinfo->isFile()) {
echo '<img style="margin: 5px; vertical-align: middle;" src="data/thumbnails/'.$cat_id.'/' $fileinfo->getFilename() . '" />';
}
}
        
?>

</div>
</div>

3.   Öffne lang/your lang/main.php und such nach:

   $lang['new_upload_validate_desc'] = "Nach Überprüfung durch einen Administrator wird Ihr Bild freigeschaltet.";

   füg danach folgendes ein:

//-----------------------------------------------------
//--- Image Upload Multi ----------------------
//-----------------------------------------------------
$lang['user_upload_multi'] = "Bilder Upload";
$lang['user_current_cat'] = "Lade in folgendes Album Bilder hoch:";
$lang['user_upload_multi_other_cat'] = "Oder wähle ein anderes Album aus:";


4.   öffne lang/your lang admin.php und such nach:

   $setting['auto_thumbnail_quality'] = "Bild-Qualität des erstellten Thumbnails<br /><span class=\"smalltext\">von 0 bis 100</span>";

   füg folgendes danach ein:

   
/*-- Setting-Group 10 --*/
$setting_group[10]="Multiupload Einstellungen";
$setting['max_thumb2_width'] = "Maximale Breite der Thumbnail-Bilder in Pixel";
$setting['max_thumb2_height'] = "Maximale Höhe der Thumbnail-Bilder in Pixel";
$setting['max_image2_width'] = "Maximale Breite der Bilder in Pixel";
$setting['max_image2_height'] = "Maximale Höhe der Bilder in Pixel";
$setting['auto_thumbnail_resize_type2'] = "Proportionen";
$auto_thumbnail_resize_type2_optionlist = array(
  
"1" => "Proportional verkleinern",
  
"2" => "Quadratisch verkleinern",
);
$setting['auto_thumbnail2_quality'] = "Bild-Qualität des erstellten Thumbnails<br /><span class=

\"smalltext\">von 0 bis 100</span>"
;
$setting['image_multi_quality'] = "Bild-Qualität der erstellten Bilder<br /><span class=\"smalltext\">von 0 

bis 100</span>"
;


5.   Öffne templates/your templates/categories.html
   such nach:

   {upload_button}

   füg fogendes danach ein:
   
   {upload_button_multi}

6.    Öffne categories.php und such nach:

   if (!check_permission("auth_upload"$cat_id)) {
  
$upload_url "";
  
$upload_button "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";


   füg folgendes danach ein:

   $upload_url_multi "";
  
$upload_button_multi "<img src=\"".get_gallery_image("multiupload_off.gif")."\" border=\"0\" alt=\"\" />";


6.1    such nach:

   $upload_url $site_sess->url(ROOT_PATH."member.php?action=uploadform&amp;".URL_CAT_ID."=".$cat_id);
  
$upload_button "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";


   für folgendes danach ein:

   $upload_url_multi $site_sess->url(ROOT_PATH."member.php?action=multiuploadform&amp;".URL_CAT_ID."=".$cat_id);
  
$upload_button_multi "<a href=\"".$upload_url_multi."\"><img src=\"".get_gallery_image("multiupload.gif")."\" border=\"0\" alt=\"\" /></a>";


6.2   such nach:

     "upload_url" => $upload_url,
  
"upload_button" => $upload_button,


   füg folgendes danach ein:

   "upload_url_multi" => $upload_url_multi,
  
"upload_button_multi" => $upload_button_multi,


7.   öffne member.php und such nach:

   $content $site_template->parse_template("member_uploadform");
}

   füg fogendes danach ein:

   
Code: [Select]
if ($action == "multiuploadform") {
  if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
    show_error_page($lang['no_permission']);
    exit;
  }

  $txt_clickstream = "";
  if ($cat_id && isset($cat_cache[$cat_id])) {
    $txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
  }
  $txt_clickstream .= $lang['user_upload'];

  if (!$sendprocess) {
    $remote_media_file = "";
    $remote_thumb_file = "";
    $image_name = "";
    $image_description = "";
    $image_keywords = "";
    $image_download_url = "";
    $image_allow_comments = 1;
  }
  

  if (check_permission("auth_directupload", $cat_id)) {
  $direct_upload = "1";
  }
  else {
  $direct_upload = "0";
  }

  $site_template->register_vars(array(
    "cat_id" => $cat_id,
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  ORIGINAL LINE:
    "cat_name" => ($cat_id != 0) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id),
*/
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  BEGIN REPLACE
*/
"cat_name" => ($cat_id != 0) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id),
    "upload_dropdown_multi" => get_category_dropdown_upload($cat_id),
//    "cat_name" => ($cat_id != 0 && (!isset($HTTP_POST_VARS['showdropdown']))) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id)."<input type=\"hidden\" name=\"showdropdown\" value=\"1\">",
    "cat_name_required" => addslashes(preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['category']), $lang['field_required'])),
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  END REPLACE
*/
"lang_user_upload_multi" => $lang['user_upload_multi'],
"lang_user_current_cat" => $lang['user_current_cat'],
"lang_user_upload_multi_other_cat" => $lang['user_upload_multi_other_cat'],
"direct_upload" => $direct_upload,
"image_multi_quality" => $config['image_multi_quality'],
"thumbnail_proportions" => $config['auto_thumbnail_resize_type2'],
"auto_thumbnail2_quality" => $config['auto_thumbnail2_quality'],
"user_id_upload_multi" => $user_info['user_id'],
"max_image2_width" => $config['max_image2_width'],
"max_image2_height" => $config['max_image2_height'],
"max_thumb2_width" => $config['max_thumb2_width'],
"max_thumb2_height" => $config['max_thumb2_height']
  ));

  $content = $site_template->parse_template("member_multiuploadform");
}

8.   kopier die Datei multiupload_2.php und thumbnail.php von der rar Datei in dein root(Haupt)    Verzeichnis.

9.   Öffne includes/functions.php und füg vor ?> folgendes ein:

/*
  MOD UPLOAD CATEGORIES DROPDOWN
  BEGIN INSERT
*/
function get_category_dropdown_upload_bits($cat_id 0$cid 0$depth 1)
{
  global 
$site_db$drop_down_cat_cache$cat_cache$config;

  if (!isset(
$drop_down_cat_cache[$cid]))
  {
    return 
"";
  }
  
$category_list "";
  foreach (
$drop_down_cat_cache[$cid] as $key => $category_id)
  {
    if (
check_permission("auth_viewcat"$category_id))
    {
      if (
check_permission("auth_upload"$category_id))
      {
        
$disable 0;
      }
      else
      {
        
$disable 1;
      }
      
$category_list .= "<option value=\"".(($disable) ? $category_id)."\"";
      if (
$cat_id == $category_id)
      {
        
$category_list .= " selected=\"selected\"";
      }
      if (
$disable)
      {
        if ((
$cat_cache[$category_id]['cat_parent_id'] == 0))
        {
          
$category_list .= " class=\"dropdowndisable\""//upload not avalable and this is a main category
        
}
        else
        {
          
$category_list .= " class=\"dropdowndisable\""//upload not avalable
        
}
      }
      else
      {
        if ((
$cat_cache[$category_id]['cat_parent_id'] == 0))
        {
//          $category_list .= " class=\"dropdownmarker\""; //upload avalable and this is a main category
        
}
        else
        {
//        $category_list .= " class=\"dropdownok\""; //upload avalable
        
}
      }

//      $category_list .= ">".(($disable) ? "- " : "+ ");
      
$category_list .= ">";
      if (
$depth 1)
      {
        
$category_list .= str_repeat("--"$depth 1)." ";
      }
      
$category_list .= $cat_cache[$category_id]['cat_name']."</option>\n";
      
$category_list .= get_category_dropdown_upload_bits($cat_id$category_id$depth 1);
    }
  }
  unset(
$drop_down_cat_cache[$cid]);
  return 
$category_list;
}
function 
get_category_dropdown_upload($cat_id 0)
{
  global 
$lang$drop_down_cat_cache$cat_parent_cache;
  
$category "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
  
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
  
$category .= "<option value=\"0\">-------------------------------</option>\n";
  
$drop_down_cat_cache = array();
  
$drop_down_cat_cache $cat_parent_cache;
  
$category .= get_category_dropdown_upload_bits($cat_id);
  
$category .= "</select>\n";
  return 
$category;
}
/*
  MOD UPLOAD CATEGORIES DROPDOWN
  END INSERT
*/


10.   Öffne admin/settings.php und such nach:

   show_setting_row("auto_thumbnail_resize_type""show_auto_thumbnail_resize_type_options");
  
show_setting_row("auto_thumbnail_quality");


   füg folgendes danach ein:

     
  show_table_separator($setting_group[10], 2"setting_group_10");
  
show_setting_row("max_thumb2_width");
  
show_setting_row("max_thumb2_height");
  
show_setting_row("max_image2_width");
  
show_setting_row("max_image2_height");
  
show_setting_row("auto_thumbnail_resize_type2""show_auto_thumbnail_resize_type2_options");
  
show_setting_row("auto_thumbnail2_quality");
  
show_setting_row("image_multi_quality");


10.1    such nach:

   function show_auto_thumbnail_resize_type_options($setting_name$setting_value) {
  global 
$auto_thumbnail_resize_type_optionlist;
  foreach (
$auto_thumbnail_resize_type_optionlist as $key => $val) {
    echo 
"<input type=\"radio\" name=\"setting_item[".$setting_name."]\" value=\"$key\"";
    if (
$setting_value == $key) {
      echo 
" checked=\"checked\"";
    }
    echo 
"> ".$val."<br />";
  }
}


   füg folgendes danach ein:

   
function show_auto_thumbnail_resize_type2_options($setting_name$setting_value) {
  global 
$auto_thumbnail_resize_type2_optionlist;
  foreach (
$auto_thumbnail_resize_type2_optionlist as $key => $val) {
    echo 
"<input type=\"radio\" name=\"setting_item[".$setting_name."]\" value=\"$key\"";
    if (
$setting_value == $key) {
      echo 
" checked=\"checked\"";
    }
    echo 
"> ".$val."<br />";
  }
}


11. Öffne fogendes Verzeichnis:
     templates/your templates/style.css und füg am Schluss folgendes ein:

/*--Mutliupload-----------------------------------------------*/
/*--Mutliupload-----------------------------------------------*/
/*--Mutliupload-----------------------------------------------*/
/*--Mutliupload-----------------------------------------------*/


/* -- Form Styles ------------------------------- */
form {
	

	
margin0;
	
padding0;
}



div.fieldset {
	
border:  1px solid #afe14c;
	
margin10px 0;
	
padding20px 10px;
}
div.fieldset span.legend {
	
positionrelative;
	
background-color#FFF;
	
padding3px;
	
top: -30px;
	
font700 14px ArialHelveticasans-serif;
	
color#73b304;
}

div.flash {
	
width375px;
	
margin10px 5px;
	
border-color#004c75;
	

	
-
moz-border-radius:5px 5px 5px 5px/* Firefox */
	
-
webkit-border-radius:5px 5px 5px 5px/* Chrome, Safari */
	
-
khtml-border-radius:5px 5px 5px 5px/* Konqueror */
	
border-radius:5px 5px 5px 5px/* CSS3 */

}

button,
input,
select,
textarea 
	
border-width1px
	
margin-bottom10px;
	
padding2px 3px;
}



input[disabled]{ border1px solid #ccc } /* FF 2 Fix */


label 
	
width150px
	
text-alignright
	
display:block;
	
margin-right5px;
}

#btnSubmit { margin: 0 0 0 155px ; }

/* -- Table Styles ------------------------------- */
td {
	
font10pt HelveticaArialsans-serif;
	
vertical-aligntop;
}

.
progressWrapper {
	
width375px;
	
overflowhidden;
}

.
progressContainer {
	
margin5px;
	
padding4px;
	
bordersolid 1px #E8E8E8;
	
background-color#F7F7F7;
	
overflowhidden;
}
/* Message */
.message {
	
margin1em 0;
	
padding10px 20px;
	
bordersolid 1px #FFDD99;
	
background-color#FFFFCC;
	
overflowhidden;
}
/* Error */
.red {
	
bordersolid 1px #B50000;
	
background-color#FFEBEB;
}

/* Current */
.green {
	
bordersolid 1px #DDF0DD;
	
background-color#EBFFEB;
}

/* Complete */
.blue {
	
bordersolid 1px #CEE2F2;
	
background-color#F0F5FF;
}

.
progressName {
	
font-size8pt;
	
font-weight700;
	
color#555;
	
width323px;
	
height14px;
	
text-alignleft;
	
white-spacenowrap;
	
overflowhidden;
}

.
progressBarInProgress,
.
progressBarComplete,
.
progressBarError {
	
font-size0;
	
width0%;
	
height2px;
	
background-colorblue;
	
margin-top2px;
}

.
progressBarComplete {
	
width100%;
	
background-colorgreen;
	
visibilityhidden;
}

.
progressBarError {
	
width100%;
	
background-colorred;
	
visibilityhidden;
}

.
progressBarStatus {
	
margin-top2px;
	
width337px;
	
font-size7pt;
	
font-familyArial;
	
text-alignleft;
	
white-spacenowrap;
}

a.progressCancel {
	
font-size0;
	
displayblock;
	
height14px;
	
width14px;
	
background-imageurl(../../includes/multiupload2/images/cancelbutton.gif);
	
background-repeatno-repeat;
	
background-position: -14px 0px;
	
floatright;
}

a.progressCancel:hover {
	
background-position0px 0px;
}


/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
	
vertical-aligntop;
}


12.   Öffne fogende Datei:
       templates/your templates/header.html und such nach

</head>
      
       füg davor fogendes ein:

<script type="text/javascript" src="includes/multiupload2/swfupload/swfupload.js"></script>
<
script type="text/javascript" src="includes/multiupload2/swfupload/swfupload.queue.js"></script>
<
script type="text/javascript" src="includes/multiupload2/js/handlers.js"></script>



13.   Lade die Datei multiupload.gif und multiupload_off.gif in folgendes Verzeichnis:
       templates/your templates/images/

14.    zum Schluss lade noch die install_multiupload.php in dein root(Haupt) Verzeichnis und öffne diese in einem Browser, danach wenn alles geklappt hat kannst du die Datei wieder von deinem Server löschen. Ich hoff ich hab jetzt nichts vergessen, bei Fragen einfach melden.

15. Edit: für umlaute im Bildnamen:

such in der multiupload_2.php:

Code: [Select]
$valid_chars_regex = '.A-Z0-9_ !@#$%^&+={}\[\]\',~`-';
$file_name_1 = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES['Filedata']['name']));
$file_name_2 = preg_replace("/\.jpg$/i", "", $file_name_1);
$file_name_3 = str_replace(' ', '_', $file_name_2);
$file_name_4 = strtolower($file_name_3);

// 4images Name
$file_name_4images = $file_name_2;

$file_name = $file_name_4 . ".jpg";

und ersetz es mit:

Code: [Select]
$valid_chars_regex = '.A-Z0-9_ !@#$%^&+={}\[\]\',~`-';
$umlaute_1 = array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
$replace_1 = array("ae","oe","ue","Ae","Oe","Ue","ss");
$file_name_0 = preg_replace($umlaute_1, $replace_1, ($_FILES['Filedata']['name']));  
$file_name_1 = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($file_name_0));
$file_name_2 = preg_replace("/\.jpg$/i", "", $file_name_1);
$file_name_3 = str_replace(' ', '_', $file_name_2);
$file_name_4 = strtolower($file_name_3);
$umlaute_2 = array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
$replace_2 = array("&auml;","&ouml;","&uuml;","&Auml;","&Ouml;","&Uuml;","&szlig;");
$file_name_5 = preg_replace($umlaute_2, $replace_2, ($_FILES['Filedata']['name']));
$file_name_6 = str_replace('_', ' ', $file_name_5);
$file_name_7 = preg_replace("/\.jpg$/i", "", $file_name_6);


// 4images Name
$file_name_4images = $file_name_7;


$file_name = $file_name_4 . ".jpg";

2
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#msg162118

Edit: 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.php

bei 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) == || 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"
	
	
	
	
},
	
	
	
	
debugfalse,

	
	
	
	
// 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 &amp; Hochladen</span>',
	
	
	
	
button_text_style".theFont { font-size: 16; }",
	
	
	
	
button_text_left_padding12,
	
	
	
	
button_text_top_padding3,
	
	
	
	

	
	
	
	
// 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 {
	

	
margin0;
	
padding0;
}



div.fieldset {
	
border:  1px solid #afe14c;
	
margin10px 0;
	
padding20px 10px;
}
div.fieldset span.legend {
	
positionrelative;
	
background-color#FFF;
	
padding3px;
	
top: -30px;
	
color#73b304;
}

div.flash {
	
width375px;
	
margin10px 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-width1px
	
margin-bottom10px;
	
padding2px 3px;
}



input[disabled]{ border1px solid #ccc } /* FF 2 Fix */


label 
	
width150px
	
text-alignright
	
display:block;
	
margin-right5px;
}

#btnSubmit { margin: 0 0 0 155px ; }

/* -- Table Styles ------------------------------- */
td {
	
vertical-aligntop;
}

.
progressWrapper {
	
width357px;
	
overflowhidden;
}

.
progressContainer {
	
margin5px;
	
padding4px;
	
bordersolid 1px #E8E8E8;
	
background-color#F7F7F7;
	
overflowhidden;
}
/* Message */
.message {
	
margin1em 0;
	
padding10px 20px;
	
bordersolid 1px #FFDD99;
	
background-color#FFFFCC;
	
overflowhidden;
}
/* Error */
.red {
	
bordersolid 1px #B50000;
	
background-color#FFEBEB;
}

/* Current */
.green {
	
bordersolid 1px #DDF0DD;
	
background-color#EBFFEB;
}

/* Complete */
.blue {
	
bordersolid 1px #CEE2F2;
	
background-color#F0F5FF;
}

.
progressName {
	
color#555;
	
width323px;
	
height14px;
	
text-alignleft;
	
white-spacenowrap;
	
overflowhidden;
}

.
progressBarInProgress,
.
progressBarComplete,
.
progressBarError {
	
width0%;
	
height2px;
	
background-colorblue;
	
margin-top2px;
}

.
progressBarComplete {
	
width100%;
	
background-colorgreen;
	
visibilityhidden;
}

.
progressBarError {
	
width100%;
	
background-colorred;
	
visibilityhidden;
}

.
progressBarStatus {
	
margin-top2px;
	
width337px;
	
font-familyArial;
	
text-alignleft;
	
white-spacenowrap;
}

a.progressCancel {
	
displayblock;
	
height14px;
	
width14px;
	
background-imageurl(../../includes/multiupload/images/cancelbutton.gif);
	
background-repeatno-repeat;
	
background-position: -14px 0px;
	
floatright;
}

a.progressCancel:hover {
	
background-position0px 0px;
}


/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
	
vertical-aligntop;
}


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_height800,
	
	
	
	
	
thumbnail_width800,
	
	
	
	
	
thumbnail_quality100


hier 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 {
	

	
margin0;
	
padding0;
}



div.fieldset {
	
border:  1px solid #afe14c;
	
margin10px 0;
	
padding20px 10px;
}
div.fieldset span.legend {
	
positionrelative;
	
background-color#FFF;
	
padding3px;
	
top: -30px;
	
color#73b304;
}

div.flash {
	
width375px;
	
margin10px 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-width1px
	
margin-bottom10px;
	
padding2px 3px;
}



input[disabled]{ border1px solid #ccc } /* FF 2 Fix */


label 
	
width150px
	
text-alignright
	
display:block;
	
margin-right5px;
}

#btnSubmit { margin: 0 0 0 155px ; }

/* -- Table Styles ------------------------------- */
td {
	
vertical-aligntop;
}

.
progressWrapper {
	
width357px;
	
overflowhidden;
}

.
progressContainer {
	
margin5px;
	
padding4px;
	
bordersolid 1px #E8E8E8;
	
background-color#F7F7F7;
	
overflowhidden;
}
/* Message */
.message {
	
margin1em 0;
	
padding10px 20px;
	
bordersolid 1px #FFDD99;
	
background-color#FFFFCC;
	
overflowhidden;
}
/* Error */
.red {
	
bordersolid 1px #B50000;
	
background-color#FFEBEB;
}

/* Current */
.green {
	
bordersolid 1px #DDF0DD;
	
background-color#EBFFEB;
}

/* Complete */
.blue {
	
bordersolid 1px #CEE2F2;
	
background-color#F0F5FF;
}

.
progressName {
	
font-weight700;
	
color#555;
	
width323px;
	
height14px;
	
text-alignleft;
	
white-spacenowrap;
	
overflowhidden;
}

.
progressBarInProgress,
.
progressBarComplete,
.
progressBarError {
	
font-size0;
	
width0%;
	
height2px;
	
background-colorblue;
	
margin-top2px;
}

.
progressBarComplete {
	
width100%;
	
background-colorgreen;
	
visibilityhidden;
}

.
progressBarError {
	
width100%;
	
background-colorred;
	
visibilityhidden;
}

.
progressBarStatus {
	
margin-top2px;
	
width337px;
	
font-familyArial;
	
text-alignleft;
	
white-spacenowrap;
}

a.progressCancel {
	
font-size0;
	
displayblock;
	
height14px;
	
width14px;
	
background-imageurl(../images/cancelbutton.gif);
	
background-repeatno-repeat;
	
background-position: -14px 0px;
	
floatright;
}

a.progressCancel:hover {
	
background-position0px 0px;
}


/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
	
vertical-aligntop;
}



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

3
hi habe mir nach langer zeit mal fancyupload http://digitarald.de/project/fancyupload/ in meine seite integriert, ich hab jetzt aber noch ein problem:
und zwar wie muss der upload paft heißßen, damit sich fancyupload selbst die cat id sucht und in den pfad mit einbindet?
hier is mal einer der aber noch nicht stimmt. ich hab da jetzt schon 3 stunden rumprobiert aber nicht auf die richtige lösung gekommen.

move_uploaded_file($_FILES['Filedata']['tmp_name'], '../data/media/echo '$cat_id'/' . $_FILES['Filedata']['name']);
$return['src'] = '/uploads/' . $_FILES['Filedata']['name'];

ich mein also den teil mit echo '$cat_id', was muss ich dafür verändern, damit der pfad funktioniert???

schonmal danke im vorraus

4
Erstmal hallo zusammen. also erstmal danke für die gute foto gallery.

ich hätte aber da noch so ne frage und zwar ob mir vielleicht helfen kann, die seite hier http://digitarald.de/project/fancyupload/3-0/showcase/photoqueue/ in 4images zu integrieren, also die upload funktion mein ich? und mir dann ne anleitung zu erstellen.
wär echt sau cool von euch, ich bin leider nich so der profi was des coden angeht.
schonmal danke im vorraus
lg

ps: bin mir jetzt nicht sicher ob die sektion hier stimmt von meinem post.

Pages: [1]