A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: php script error giving me aneurysm

  1. #1
    Senior Member
    Join Date
    Nov 2004
    Posts
    286

    php script error giving me aneurysm

    Here is the error:

    Warning: move_uploaded_file(files/signed.jpg): failed to open stream: Permission denied in /hsphere/local/home/naturalt/naturaltalent.cc/xml2/uploader.php on line 116

    Warning: move_uploaded_file(): Unable to move '/tmp/phphAjTf1' to 'files/signed.jpg' in /hsphere/local/home/naturalt/naturaltalent.cc/xml2/uploader.php on line 116


    here is the php code:

    <?
    /*
    Multifile Uploader Script - Copyright © Teletone [Canada] / 2t2.com
    Author : Gordon Black
    Contact : [email protected]
    Last Modified : April 27, 2005
    This script may be freely distributed as long as this header remains intact
    */

    // SETTINGS //
    // Config
    $dirUploads = "files"; // The directory the files will be uploaded to
    $showDir = "yes";
    $numUploads = "10"; // Number of upload blanks to be shown on page
    $limitFiles = "yes"; // Allow only certain filetypes?
    $showAllowedFiles = "yes"; //
    $allowedFiles = array("jpg", "gif", "png", "bmp"); // Allowed filetypes
    $mainTableWidth = "75%";
    $stylesheet = "uploader_style.css";
    $showCopyright = "yes"; // not required, but the script IS FREE
    // Security
    $reqSecure = "yes"; // Passcode control?
    $userPassword = "2355";
    // Screen Text & Error Messages - can be changed to any language
    $caption = "MULTIFILE UPLOADER";
    $loginpageMsg = "A Passcode Is Required";
    $uploadpageMsg = "Select The Files To Upload";
    $passwordText = "Passcode :";
    $loginButtonText = "Go To Upload Page";
    $logoutText = "logout now";
    $allowedfiletypesText = "Allowed Filetypes";
    $lineText = "File";
    $uploadButtonText = "Upload Files";
    $statusText = "Upload Status :";
    $nofileText = "No file selected for upload";
    $notallowedText = "NOT ALLOWED";
    $existsText = "ALREADY EXISTS";
    $successText = "has been uploaded";
    // END OF SETTINGS //

    $pageTop = "<html><head><title>$caption</title><link href=$stylesheet rel=stylesheet type=text/css></head><body><div align=\"center\" class=caption>$caption</div>";

    $pre = "Multifile Uploader";
    $version = "2.0";
    $startdate = "2003";

    $copyright ="&nbsp;<p><div align=center class=copybar>$pre (v.$version) Copyright © $startdate - ". date ("Y")." <a href=http://www.2t2.com target=_new>Teletone [Canada] / 2t2.com</a></div>";

    $pageBottom = "</body></html>";

    // session management
    if($reqSecure == "yes") {
    session_start();
    if (!session_is_registered("mfupload")) {
    if (isset($_POST["password"]) && $_POST["password"] == $userPassword) {
    session_register("mfupload");
    $_SESSION["mfupload"] = $_POST["password"];
    header("Location: $PHP_SELF");
    exit;
    }
    else {
    // login page
    echo $pageTop;
    echo "&nbsp;<p><div align=\"center\" class=sitetag>$loginpageMsg</div>";
    echo "&nbsp;<p><div align=\"center\"><table border=0>";
    echo "<form name=loginform method=post action=$PHP_SELF>";
    echo "<tr><th>$passwordText</th><td><input type=password name=password style=\"width: 135px;\"></td>";
    echo "<th>&nbsp;</th><td><input type=submit class=button value=\"$loginButtonText\" style=\"width: 135px;\"></td></tr>";
    echo "</form></table></div>";
    echo "<script language=javascript>document.loginform.password.se lect();document.loginform.password.focus();</script>";
    if($showCopyright == "yes") {
    echo $copyright;
    }
    echo $pageBottom;
    exit;
    }
    }
    }

    // kill session
    if($_GET["action"]=="logout") {
    session_unset("mfupload");
    header("Location: $PHP_SELF");
    exit;
    }

    if($doupload) {
    global $allowedFiles;
    $num = 0;
    while($num < $numUploads) {
    $num++;

    $upFile = "dofile$num"."_name";
    $upFile1 = $$upFile;
    $upFile2 = "dofile$num";
    $upFile3 = $$upFile2;

    $ext = substr(strrchr( $upFile1 , "." ), 1);
    $ext = str_replace("jpeg", "jpg", $ext);

    $size = filesize($upFile3)/1024;
    $size = round($size,1);

    // error messages
    if($upFile3 == "") {
    $msg_upload .= "<tr><td>$lineText $num :</td><td colspan=2>$nofileText</td></tr>";
    }
    elseif($limitFiles == "yes" && !in_array($ext,$allowedFiles)) {
    $msg_upload .= "<tr><td>$lineText $num :</td><td><b>$upFile1</b></td><td>$notallowedText</td></tr>";
    }
    elseif(file_exists("$dirUploads/$upFile1")) {
    $msg_upload .="<tr><td>$lineText $num :</td><td><b>$upFile1</b></td><td>$existsText</td></tr>";
    }
    else {
    // everything OK
    move_uploaded_file ($upFile3, "$dirUploads/$upFile1");
    $msg_upload .="<tr><td>$lineText $num :</td><td><b>$upFile1</b> ($size)</td><td>$successText</td></tr>";
    }
    }
    }

    // upload page
    echo $pageTop;
    if ($reqSecure == "yes" && session_is_registered("mfupload")) {
    echo "<div align=\"right\"><a href=$PHP_SELF?action=logout>$logoutText</a>&nbsp;&nbsp;&nbsp;</div>";
    }
    echo "<div align=\"center\" class=sitetag>$uploadpageMsg</div>";
    echo "&nbsp;<p><div align=\"center\"><table width=$mainTableWidth border=\"0\" class=bodytable>";
    if($showAllowedFiles == "yes") {
    echo "<tr><th colspan=2><div align=\"center\">$allowedfiletypesText : ";
    for($i=0;$i<count($allowedFiles);$i++) {
    if (($i<>count($allowedFiles)-1))$commas=", "; else $commas="";
    list($key,$value)=each($allowedFiles);
    echo $value.$commas;
    }
    }
    echo "</div></td></tr>";
    echo "<tr><td width=50%><table width=100% border=0>";
    echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF\" method=\"post\">";
    $num = 0;
    while($num < $numUploads) {
    $num++;
    echo "<tr><th style=\"width: 20%;\">$lineText $num:</td><td><input name=\"dofile$num\" type=\"file\" style=\"width: 100%;\"></td></tr> ";
    }
    echo "<tr><td style=\"width: 20%;\">&nbsp;</td><td><input name=\"doupload\" type=\"submit\" value=\"$uploadButtonText\" class=button style=\"width: 100%;\"></td></tr>";
    echo "</form>";
    echo "</table></td>";
    echo "<td width=50%><div align=\"center\"><table width=95% border=0 class=msg_table>";
    if($msg_upload) {
    echo "<tr><th colspan=3><div align=\"center\">$statusText ";
    if($showDir == "yes") {
    echo $dirUploads;
    }
    echo "</div></td></tr>";
    echo $msg_upload;
    }
    echo "</table></div></td></tr></table></div>";
    if($showCopyright == "yes") {
    echo $copyright;
    }
    echo $pageBottom;
    ?>


    Please PLEASE how do I fix this?????

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    create the files folder, if it does not exist yet,
    and chmod it to 777

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center