ı want to upload image with jquery post. ı dont want to use form.
the problem is ı just got image name, ı cant use this:
$size=filesize($_FILES['image']['tmp_name']);
$copied = copy($_FILES['image']['tmp_name'], $newname);
my jquery function:
$('#add').click(function(){
var image=$('#image').val();
$.post(
'select.php?p=up',
{img:image},
function(answer){
$('#sonuc').html(answer);
}
);
});
html code:
<form name="newad" method="post" enctype="multipart/form-data" action="" id="form">
<table>
<tr><td><input type="file" name="image" id="image"></td></tr>
<tr><td><input name="Submit" type="button" value="Upload" id="add"></td></tr>
</table>
</form>
not: it works when ı submit form but it doesnt work like this, and ı have to do this.