I have got this in my index.php
if (isset($_POST['PostSubm'])) {
$file=$_FILES['ImageTi'];
$file_name=$file['name'];
$file_tmp=$file['tmp_name'];
$file_size=$file['size'];
$file_error=$file['error'];
$file_extension=explode('.', $file_name);
$file_extension=strtolower(end($file_extension));
$allowed=array('jpg','png');
if (in_array($file_extension, $allowed)) {
if ($file_error===0) {
if ($file_size<=2097152) {
$file_new_name=generateRandomString(15).rand(0,100).'.'.$file_extension;
$_SESSION['file_new_name']=$file_new_name;
$file_destination='../uploads/'.$file_new_name;
if (!move_uploaded_file($file_tmp,$file_destination)) {
echo "<p class='filerror'>Error</p>";
exit();
}
}
}
}
}
And this HTML
<form method="post" class="Postshf" enctype="multipart/form-data">
<input type="file" name="ImageTi" id="PhotoPost">
<textarea name="Text" placeholder="Your text here" maxlength="400" class="descrp"></textarea>
<input type="submit" name="PostSubm" class="PostSub" value="Post">
</form>
And i have also got this in my jquery.js
$(".Postshf").submit(function(){
var descrp=$(".descrp").val();
var s=$(".sasa").text();
$.ajax({
type: "GET",
url: '../files/connect.php',
data: "Namess="+names+"&Left="+left+"&top="+top+"&d="+descrp+"&r="+s,
success: function(data)
{
alert(data);
}
});
});
So my goal is to move file that was uploaded to "ImageTi" and at the same time insert the name of that file to database.But i am having no luck