ajax - Image upload and form data with bootstrap modal -
ajax - Image upload and form data with bootstrap modal -
i trying upload image server , add together database in 1 shot. using bootstrap, not sure if problem image not uploading, nor giving me file name @ all.
<form class="additem" role="form" method="post" enctype="multipart/form-data" action="add_item.php"> <div class="form-group"> <input type="text" name="name" class="form-control" placeholder="item name..."> </div> <div class="form-group"> <input type="file" name="image" class="form-control" placeholder="upload image..."> </div> <button type="button" class="btn btn-primary" id="additem">add item</button> <script type="text/javascript"> $(document).ready(function () { $("button#additem").click(function(){ $.ajax({ type: "post", url: "add_item.php", data: $('form.additem').serialize(), success: function(msg){ $("#thanks").html(msg); $("#itemmodal").modal('hide'); }, error: function(){ alert("failure"); } }); }); }); </script> the other info submitting fine, not image.
ajax image twitter-bootstrap image-uploading
Comments
Post a Comment