Krummelz Posted November 17, 2008 Share Posted November 17, 2008 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. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 17, 2008 Share Posted November 17, 2008 Do you want this: admin/banners/banner3.jpg to be this: /admin/banners/banner3.jpg ? Quote Link to comment Share on other sites More sharing options...
Krummelz Posted November 17, 2008 Author Share Posted November 17, 2008 Indeed yes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.