0

Do you know what's the problem of this SQL code? THanks.

if (move_uploaded_file($_FILES['resume']['tmp_name'], 'uploads/'.$_FILES['resume']['name'])){
            $insert_data3 = "INSERT into applicant_other_details(`position`,`learn_from`,`work_availability`,`resume`,`date_submitted`) 
                        VALUES ('".$_POST['app_position']."','".$about_job."','".$work_avail."','uploads/".$_FILES['resume']['name']."','".CURDATE()."')";
        mysql_query($insert_data3) or die(mysql_error());
        } 
13
  • what is the error you get??? Commented Feb 9, 2015 at 5:50
  • I dont get any error but nothing is uploading into the folder or into the database. @habibulhaq Commented Feb 9, 2015 at 5:51
  • could be the reason. dont use mysql_query as it is deprecated use mysqli_query instead. Commented Feb 9, 2015 at 5:52
  • I think your upload path not correct? Commented Feb 9, 2015 at 5:53
  • You can put the default value as CURRENT_TIMESTAMP in the mysql table design. Then it will add automatically. I think you have disabled the error reporting or this block is not executing. Is there any if condition before this code? If so check if the condition is satisfying to execute the code Commented Feb 9, 2015 at 5:59

2 Answers 2

2
<form method="post" enctype="multipart/form-data">
<label for="name"><br>Attact resume:</label>
<input type="file" class="form-control" id="resume" name="resume">
<input type="submit" ></form>

if you want to upload a file you should use enctype="multipart/form-data" in your form tag

Sign up to request clarification or add additional context in comments.

Comments

0

I guess there is problem with your form.. did you include enctype="multipart/form-data" in your form..?

When using form to POST data use this way

<form action="post_request_page.php" method="post" enctype="multipart/form-data">

enctype="multipart/form-data"in case your are trying to upload a file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.