1

I want to show the uploaded image on the same page without refreshing the page .

<form action='xyz.php' method='post' enctype='multipart/form-data'>
<input type='file' name='image' id='image'>
<input type='submit' name='ok' id='ok' value='upload'>
</form>

<div id='uploadedImage'></div>    

<script>

$(document).ready(function(){

    $('#ok').click(function (e) {
         e.preventDefault();
         // then should be the jquery ajax call and response ?
         // help with this code . 

    });

});
</script>
4

2 回答 2

0

Check out this jQuery File Upload plugin.

于 2013-02-25T09:18:44.620 回答
0

By standart means you can't (you can, but in two words you have to write many code with hiding inputs and showing buttons). But there are several good plugins you can use. You can check https://github.com/valums/file-uploader. It is open-code, so you can either use it or you can see how ajax upload is implemented

于 2013-02-25T09:22:32.083 回答