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
https://forums.phpfreaks.com/topic/133073-uploading-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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