Jump to content

Krummelz

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by Krummelz

  1. Here is my code:

     

    <div id="main">
          <div id="caption">UPLOAD A BANNER</div>
          <div id="icon"> </div>
          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileForm" id="fileForm" enctype="multipart/form-data">
            File to upload:<center>
            <table>
             	 <tr><td><input name="upfile" type="file" size="36"></td></tr>
    	  	<tr><td align="left">Title<br/><input type="text" name="title" /></td></tr>
    		<tr><td align="left">Link<br/><input type="text" name="link" /></td></tr>
    		<tr><td align="left">Size<br/><select name="size"><option value="big">350x100</option><option name="small">550x100</option></select></td></tr>
    		<tr><td align="left"> </td></tr>
              <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Upload"></td></tr>
            </table></center>  
          </form>
    <?php    
        if (isset($_POST['submitBtn'])){
    
    ?>
          <div id="caption">RESULT</div>
          <div id="icon2"> </div>
          <div id="result">
            <table width="100%">
    <?php
    
    $target_path = $uploadLocation . basename( $_FILES['upfile']['name']);
    
    if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {      <-    THIS IS LINE 113
        echo "The file: ".  basename( $_FILES['upfile']['name']).
        " has been uploaded!";
    } else{
        echo "There was an error uploading the file, please try again!";
    }
    
    ?>
            </table>
         </div>
    <?php            
        }
    ?>
        </div>
    

     

     

    And here are the errors I get:

     

     

    Warning: move_uploaded_file(admin/banners/banner3.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/creditte/public_html/admin/banners.php on line 113

     

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phppCegl9' to 'admin/banners/banner3.jpg' in /home/creditte/public_html/admin/banners.php on line 113

     

    Can anyone shed some light on this? Why doesnt it upload? I have checked permissions on the folder it uploads to and they are are set to 777.

  2. The class is a free download from Softpedia.com -> http://webscripts.softpedia.com/scriptDownload/Easy-PHP-Upload-Download-1861.html

     

    I think I may have found the problem, and this killed two birds with one stone - I could not get errors to show even when I did add error_reporting(E_ALL);

     

    Adding error_reporting(E_ALL); and ini_set("display_errors","1"); showed me that the $_SERVER['DOCUMENT_ROOT'] in the include line made it point to the wrong directory of "C:/wamp/www/classes/upload/upload_class.php" instead of "C:/wamp/www/WEBSITENAME/classes/upload/upload_class.php"

     

    Thanks guys.

  3. OK I'm really frustrated here. I have a class that is meant to handle uploading of files to the server.

     

    When I comment out the line that instantiates the class, everything works fine. When I try to instantiate the class, I get a blank page.

     

    Here are the most important lines of code:

     

    include ($_SERVER['DOCUMENT_ROOT']."/classes/upload/upload_class.php");

    $my_upload = new file_upload;

     

    I have no idea what to do ???, and have been searching the web for a while now, without an answer.

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.