开发者

jQuery post upload file

I have a image upload form which adds an image to my server, although I'm wanting to load the information through jQuery ajax so the form doesn't refresh on submit.

At the moment I have

     $('.img-form').submit(function(e) {
e.preventDefault();
$.post(document.href, $(".img-form").serialize());

});

Which seems to post the document, although i need to get it to call my ImageUpload() function from the PHP once I've pressed the submit.

My php function is calle开发者_StackOverflowd something like this,

<?php $Users->TutorialImageUpload(); ?>


If I understood correctly, you wish to upload an image without refreshing the page, and call your imageUpload() function.

As mentioned in the comments, you cannot upload in such a manner, however, what you could do is put your upload form and code in a seperate php file and include it in the page as an iframe. This would upload your files withough refreshing the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜