Jump to content

Uploading files


Krummelz

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.