Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="uploadform" name="uploadform" method="POST" enctype="multipart/form-data">
- <input id="realupload" name="realupload" type="file" multiple/>
- <input id="uploadsubmit" type="submit" value="upload"/>
- </form>
- $('#uploadsubmit').click(function(e)
- {
- e.preventDefault();
- $.ajax({
- type: "POST",
- url: "upload.php",
- data: function(){
- alert("test");
- var data = new FormData();
- data.append("realupload", jQuery("#realupload").get(0).files[0]);
- return data;
- }
- ,
- processData:false,
- contentType: false,
- cache: false,
- success: function(theData){
- $('#innercontent').html(theData);
- },
- error: function() {
- $('#innercontent').html("ERROR, HELP");
- }
- });
- }
- });
- <?php
- //upload.php
- if (isset($_FILES["realupload"]))
- {
- echo "SUCCESSFUL UPLOAD " . $_FILES["realupload"]["error"];
- }
- else{
- echo "FILES NOT SET";
- }
- ?>
- Hello,
- Just use new jquery library jquery-2.1.1.min.js
- from
- http://jquery.com/download/
- It will definitely solve your problem
- Few days before i was stuck with same problem so I gave try for above library it did worked for me.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement