Hello Guys , I need Help In Upload Form
i got this Error
Warning: move_uploaded_file(): Unable to move 'C:xampptmpphpE53F.tmpto'C:/xampp/htdocs/admin/uploads/imagename.jpg'inC:xampphtdocsFinaladminadd_app.php on line23
This is The Source Code
if (isset($_SESSION['logged_in'])) { if (isset($_POST['doUpload'])) { $title = $_POST['title']; $descrip = nl2br($_POST['descrip']); if (empty($title) or empty($descrip)) { $error = ' All fields are required ! '; } else{ $extension = end(explode('.',$_FILES['upload']['name'])); $filename = $_FILES['upload']['name'] ; $filetype = $_FILES['upload']['type']; $path = $_SERVER['DOCUMENT_ROOT'] . '/admin/uploads/' . $filename; if(move_uploaded_file($_FILES['upload']['tmp_name'],$path)) { $query = $db->prepare('INSERT INTO applications (APP_name,APP_descrip,Path,APP_type,APP_time) VALUES(:title,:description,:path,:type,:time)'); $query->bindParam(':title',$_POST['title']); $query->bindParam(':description',nl2br($_POST['descrip'])); $query->bindParam(':path',$filename); $query->bindParam(':type',$filetype); $query->bindParam(':time',time()); $query->execute(); header('Location: dashboard.php'); }
and this is the Html Form
<form action="add_app.php" id="newapp" method ="post" enctype="multipart/form-data"><input type="text" name="title" size="65" placeholder="Application Name"/><br /><br /><textarea rows="15" cols="65" placeholder="Application Descriptions" name="descrip"></textarea><br /><br /><div class="upload_Media btn btn-success"><span>Upload The App</span><input type="file" class="upload" name="upload" /></div><br /><br /><input type="submit"id="doUpload" value=" Add Application" class="ui-button btn btn-default" /></form><script type="text/javascript">$('#doUpload').on('click',function() {$('#newapp').submit();});</script>
Thank you Guys in Advance