I'm working with Jquery EasyUI and I have a trouble with this code. I have a form to input a file to DB and the form has a input type = file
that I want to allow an attachment. However, when the form is submitted, the $_FILES object has nothing in to DB and to the path declared.
I hope that somebody can help me to solve this trouble code. Thank you
Here is my listening code:
<form id="form" method="post" enctype="multipart/form-data">
<input type="file" name="file_att" id="file_att" size = "30px;" class="easyui-validatebox" required="true"/>
</form>
Here is my code to run the form when the form submitted:
<?php
include "../inc/inc.koneksi.php";
$file_att=$_FILES["file_att"]["name"];
$target="file_att/$file_att";
$temp=$_FILES["file_att"]["tmp_name"];
$query=mysql_query("INSERT INTO t_director(id_direc,file_att) VALUES ('NULL','$file_att')");
if(!empty($file_att)){
move_uploaded_file("$temp","$target");
echo "Success Attached";
}
else {echo "Failed";}
?>