Possible Duplicate:
jQuery Ajax File Upload
i want to upload a file using php and during the upload i want to show a loader to the user. Afterwards one div should be changed, and therefore i thought jQuery will be the right choice.
I tried it with this method, but it is not working properly:
HTML:
<div id="pop_layerbody">
<form action="javascript:;" method="post" enctype="multipart/form-data" onSubmit="jsUploadFile();">
<input name="bild" id="bild" type="file" size="50" maxlength="100000">
<input type="submit" value="Hochladen" id="button_upload">
</form>
</div>
JavaScript/JQuery:
function jsUploadFile() {
$('#pop_layerbody').html('<img src="../includes/images/ajax-loader-big.png" style="margin-top:35px;" />');
$.ajax({
type: "POST",
url: "upload_picture_logic.php",
}).done(function (msg) {
alert("Data Saved: " + msg);
});
}
PHP: (excerpt)
@move_uploaded_file($_FILES['bild']['tmp_name'], "upload/".$_FILES['bild']['name']);
Anybody know the answer? It seems that even the POST-combination between HTML and JS is not working...