Verfasst: Mi 24. Mai 2006, 11:51
Du meinst quasi, dass die User auswählen können, in welchen Ordner die Datei soll?
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
<?
$buttonstyle1 = "width:250px;height:20px;"; // Button 1
$buttonstyle2 = "width:100px;height:20px;margin-left:10px;"; // Button 2
$headcolor = "background-color:#eeeeee;padding:2px;"; // Tabellenkopf
$username="";
$adminname="";
function cut($text, $length) {
$dec = array("\"", "'", "\\", '\"', "\'", "<", ">");
$enc = array(""", "'", "\", """, "'", "<", ">");
$text = str_replace($enc, $dec, $text);
if (strlen($text) > $length) {
$text = substr($text, 0, ($length-3))."...";
}
$text = str_replace($dec, $enc, $text);
return $text;
}
$path="upload/CMS_VALUE[4]";
$username=$auth->auth['uname'];
$delpool="CMS_VALUE[5]";
$treffer_del = substr_count($delpool, $username);
if ($treffer_del==1) {
$deluser=$username;
}
$adminpool="CMS_VALUE[1]";
$treffer_admin = substr_count($adminpool, $username);
if ($treffer_admin==1) {
$adminname=$username;
}
if ($username==$adminname) {
$max_filesize_mb=CMS_VALUE[3];
} else {
$max_filesize_mb=CMS_VALUE[2];
}
$max_filesize=bcmul($max_filesize_mb,1000000);
function parseByteSize($size,$digits=2,$dir=false){
$kb=1024; $mb=1024*$kb; $gb=1024*$mb; $tb=1024*$gb;
if(($size==0)&&($dir)){return "Empty";}
else if($size<$kb){return $size." Bytes";}
else if($size<$mb){return round($size/$kb,$digits)." KB";}
else if($size<$gb){return round($size/$mb,$digits)." MB";}
else if($size<$tb){return round($size/$gb,$digits)." GB";}
else{return round($size/$tb,$digits)." TB";}
}
if ($step=="delete" && $username=="$adminname") {
unlink($path.$filename);
}
if (isset($_POST['uploadfile'])) {
$fileext = $_FILES['myfile']['type'];
$filename = $_FILES['myfile']['name'];
$filesize = $_FILES['myfile']['size'];
$filetemp = $_FILES['myfile']['tmp_name'];
if ($filesize > $max_filesize) {
$error = "<b>Die Datei ist mit $filesize Bytes größer als $max_filesize_mb MB.</b>";
}
if ($error == "") {
if (!file_exists($path.$kdnr."/"))
{
mkdir($path."$kdnr"."/",0777);
}
move_uploaded_file($filetemp, $path.$kdnr."/"."$filename");
chmod($path."$kdnr"."/"."$filename",0644);
echo "<font color=red><b>Die Datei wurde erfolgreich hochgeladen.</b></font><br>";
} else {
echo "$error";
}
}
if (CMS_VALUE[8]==1 || ($username!="" && $username!="nobody")) {
echo "<div style=\"width:610px;\" id=\"upload\"><form name=\"uploadform\" method=\"post\" action=\"$PHP_SELF?idcat=$idcat\" enctype=\"multipart/form-data\">
<div><table>
<tr><td>Kundennummer:</td><td>Datei:</td></tr>
<tr><td><input type=\"text\" name=\"kdnr\" style=\"width:110px;\" maxlength=5></td><td><input type=\"file\" name=\"myfile\" class=\"button\"><input type=\"submit\" name=\"uploadfile\" value=\"hochladen\" class=\"button\"></td></tr></table></div>
</form>
<div style=\"margin-bottom:5px;\"><strong>Bitte nur virengescannte Dateien hochladen!</strong></div>";
} else {
echo "<div>";
}
$show_list=CMS_VALUE[7];
if ($show_list==1 || $username==$adminname) {
$handle=opendir($path);
while ($file = readdir($handle)){
if ($file!='.' && $file!='..' && $file!='/') {
if (!@opendir($path.$file)==true) {
$file_list[] = $file;
}
}
}
closedir($handle);
@sort($file_list);
echo "<table align=\"left\" width=\"600px\" cellspacing=\"1\" border=\"1\" cellpadding=\"1\" style=\"border-collapse: collapse; background:#bbbbbb;\">
<tr style=\"$headcolor\">
<td style=\"$headcolor\">Dateiname</td>
<td style=\"$headcolor\">Größe</td>
<td style=\"$headcolor\">Aktion</td>";
if ($username==$deluser) echo "<td><span style=\"color:#ff0000;\">löschen</span></td>";
echo "</tr>";
for ($count=0;$file_list[$count]!="";$count++) {
echo "<tr style=\"background-color:#ffffff;\" onmouseover=\"this.style.backgroundColor = '#dddddd'\" onmouseout=\"this.style.backgroundColor = '#ffffff'\">
<td style=\"padding:2px;\"><font title='$file_list[$count]'>".cut($file_list[$count],CMS_VALUE[6])."</font></td>
<td style=\"padding:2px;\">".parseByteSize(@filesize($path.$file_list[$count]),2,false)."</td>
<td style=\"padding:2px;\"><a href='".$path."$file_list[$count]' target='_blank'><nobr>öffnen | speichern</nobr></a></td>";
if ($username==$deluser) {
echo "<td><a href='$PHP_SELF?idcat=$idcat&step=delete&filename=$file_list[$count]' target='_self'>löschen</a></td>";
}
echo "</tr>";
}
echo "</table></div><br clear=\"all\">";
} else {
echo "</div><br clear=\"all\">";
}
?>
Code: Alles auswählen
$frontendusers = new FrontendUserCollection;
$frontendusers->select("idclient = '$client' AND username = '".urlencode($auth->auth[uname])."'");
if ($frontenduser = $frontendusers->next()) {
$idfrontend = $frontenduser->get("idfrontenduser");
// Kundennummer ermitteln
$db2 = new DB_Contenido;
$sql = "SELECT
ku_nr
FROM
".$cfg['tab']['frontdatadress']."
WHERE
idfrontenduser = $idfrontend";
$db2->query($sql);
if ($db2->next_record()){
$ku_nr = $db2->f("ku_nr");
}Mhm, daran liegt es auch nicht. Ich habe zwar Unterordner im upload und auch Unter-Unterordner, es sind aber alle mit CHMOD 777 gekennzeichnet. Wenn ich das Modul als Tempelate und dann Vorkonnfiguration das erstemal aufrufe, sind auch alle felder belegt, z.B.Dinkel hat geschrieben:das Skript greift automatisch auf den Ordner "upload" zu. Schau mal per Dateiverwaltung, ob da Unterordner angelegt sind und wenn ja, dann schau noch per FTP, ob die chmod 777 haben. Dann sollte eigentlich in der Konfiguration des Moduls die Auswahl eines Ordners per Drop-Down-Auswahl möglich sein.
MhmAdministratoren (Frontend-User, mit Komma trennen): $C12CMS_VALUE[1]