Snatch
18.11.2004, 14:26
hallo,
ich habe diese Script etwas geändert. Es soll beim Upload für jeden Tag einen Ordner erstellen der CHMOD 777 is. Leider erstellt es immer nur 755. Kann mir einer helfen und den Fehler finden ?
<?
// integrate into vbb
error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');
// set usergroup can access this script
if (!in_array($bbuserinfo['usergroupid'], array(2,5,6,7,8,9,11)))
{ print_no_permission(); }
// uploader settings
//$dir = "C:/Inetpub/wwwroot"; // absolute path/dir where images are to be uploaded or /home/user/public_html/uploads for *nix
$dir = "/var/www/web1/html/images/postings/member/";
$folder=date("Ymd");
$dir.="/".$folder;
if(!file_exists($dir)){mkdir($dir,0777);}
$ext = array(".gif", ".jpg", ".jpeg", ".png"); //allowed file extensions. To add more ext, use comma to seperate them
$filesize = "1024"; // max filesize allowed to upload (in KB)
$url = "http://pics.celebritymarkt.de/images/postings/member/"; // Full URL to your upload dir
$maxwidth = 2048; // for images only ... set this if you don't ppl to upload large images, breaking table cell of your forum.
$maxheight = 1024; // for images only
// initialize & vars declaration
$title = "All4A Image Uploader - powered by tnguy3n © all4actions.net";
$header = "<font size=+1 color=darkgreen><b>Image Uploader</b></font>";
$msg = ""; // initialize
$imgurl = $url . $_FILES['img']['name'];
$dimension = @ getimagesize($_FILES['img']['tmp_name']);
$width = $dimension[0];
$height = $dimension[1];
if ($do == 'upload') {
if ($_FILES['img']['name'] == "") {
$msg = "<center><font color=\"red\">Please select a file to upload!</font></center>";
}
elseif (file_exists("$dir/".$_FILES['img']['name'])) {
$msg = "<center><font color=\"red\">Filename "."<b>". $_FILES['img']['name']."</b>" . " already exists. Please rename or upload a different file.</font></center>";
}
elseif (!in_array(strrchr($_FILES['img']['name'],'.'),$ext)) {
$msg = "<center><font color=\"red\">That file type is not allowed!</font></center>";
}
elseif (($_FILES['img']['size']/1020) > $filesize) {
$msg = "<center><font color=\"red\">The file you try to upload is too big, <b>" . round($_FILES['img']['size']/1020) . " KB</b>. Resize or upload different file!</font></center>";
}
elseif (strrchr($_FILES['img']['name'],' ')) {
$msg = "<center><font color=\"red\">Filename must not contain whitespace!</font></center>";
}
elseif($width > $maxwidth || $height > $maxheight) {
$msg = "<center><font color=\"red\">The image you try to upload is too large, " . $dimension[0] . " x " . $dimension[1] . ". Max width x height: " . $maxwidth . " x " . $maxheight . "</font></center>";
}
else {
@copy($_FILES['img'][tmp_name], "$dir/".$_FILES['img']['name']) or die("Couldn't Upload File. Check chmod of your upload dir, it must be writable.");
// wrap it up and print result
$msg = "<font color=red>Image <b>" . $_FILES['img']['name'] . "</b> has sucessfully uploaded!</font>";
eval('print_output("' . fetch_template('uploader_result') . '");');
exit;
}
}
eval('print_output("' . fetch_template('uploader') . '");');
?>
Danke euch.
ich habe diese Script etwas geändert. Es soll beim Upload für jeden Tag einen Ordner erstellen der CHMOD 777 is. Leider erstellt es immer nur 755. Kann mir einer helfen und den Fehler finden ?
<?
// integrate into vbb
error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');
// set usergroup can access this script
if (!in_array($bbuserinfo['usergroupid'], array(2,5,6,7,8,9,11)))
{ print_no_permission(); }
// uploader settings
//$dir = "C:/Inetpub/wwwroot"; // absolute path/dir where images are to be uploaded or /home/user/public_html/uploads for *nix
$dir = "/var/www/web1/html/images/postings/member/";
$folder=date("Ymd");
$dir.="/".$folder;
if(!file_exists($dir)){mkdir($dir,0777);}
$ext = array(".gif", ".jpg", ".jpeg", ".png"); //allowed file extensions. To add more ext, use comma to seperate them
$filesize = "1024"; // max filesize allowed to upload (in KB)
$url = "http://pics.celebritymarkt.de/images/postings/member/"; // Full URL to your upload dir
$maxwidth = 2048; // for images only ... set this if you don't ppl to upload large images, breaking table cell of your forum.
$maxheight = 1024; // for images only
// initialize & vars declaration
$title = "All4A Image Uploader - powered by tnguy3n © all4actions.net";
$header = "<font size=+1 color=darkgreen><b>Image Uploader</b></font>";
$msg = ""; // initialize
$imgurl = $url . $_FILES['img']['name'];
$dimension = @ getimagesize($_FILES['img']['tmp_name']);
$width = $dimension[0];
$height = $dimension[1];
if ($do == 'upload') {
if ($_FILES['img']['name'] == "") {
$msg = "<center><font color=\"red\">Please select a file to upload!</font></center>";
}
elseif (file_exists("$dir/".$_FILES['img']['name'])) {
$msg = "<center><font color=\"red\">Filename "."<b>". $_FILES['img']['name']."</b>" . " already exists. Please rename or upload a different file.</font></center>";
}
elseif (!in_array(strrchr($_FILES['img']['name'],'.'),$ext)) {
$msg = "<center><font color=\"red\">That file type is not allowed!</font></center>";
}
elseif (($_FILES['img']['size']/1020) > $filesize) {
$msg = "<center><font color=\"red\">The file you try to upload is too big, <b>" . round($_FILES['img']['size']/1020) . " KB</b>. Resize or upload different file!</font></center>";
}
elseif (strrchr($_FILES['img']['name'],' ')) {
$msg = "<center><font color=\"red\">Filename must not contain whitespace!</font></center>";
}
elseif($width > $maxwidth || $height > $maxheight) {
$msg = "<center><font color=\"red\">The image you try to upload is too large, " . $dimension[0] . " x " . $dimension[1] . ". Max width x height: " . $maxwidth . " x " . $maxheight . "</font></center>";
}
else {
@copy($_FILES['img'][tmp_name], "$dir/".$_FILES['img']['name']) or die("Couldn't Upload File. Check chmod of your upload dir, it must be writable.");
// wrap it up and print result
$msg = "<font color=red>Image <b>" . $_FILES['img']['name'] . "</b> has sucessfully uploaded!</font>";
eval('print_output("' . fetch_template('uploader_result') . '");');
exit;
}
}
eval('print_output("' . fetch_template('uploader') . '");');
?>
Danke euch.