Ajax FormData file upload not working [JQuery] [PHP] -


My upload form is not working for any reason, when I run the form PHP file and my $$$ FILES The variable is empty. I have been trapped for hours and I think I have gone through every post on this site and I do not understand what is happening.

HTML

  & lt; form id = "uploadform" name = "uploadform" method = "POST" encrypt = "multipart / form-data" & gt; & Lt; Input id = "actual upload" name = "actual upload" type = "file" multiple /> & Lt; Input id = "upload upload" type = "submit" value = "upload" / & gt; & Lt; / Form & gt; Click the   

JQuery

  $ ('# uploadsubmit') (function (e) {e.preventDefault (); $ .ajax ({Type: "Post", url: "upload.php", data: function () {warning ("test"); var data = new form data (); data .append ("realupload", jquery ("# ​​realupload") (0) .file [0]; return data;}, process data: wrong, content type: wrong, cache: wrong, success: work (data) {$ ('# innercontent'). Html ;}, Error: function () {$ ('# internal content'). Html ("error, help");}});}});   

PHP (upload.php)

  & lt ;? php //upload.php if (isset ($ _ files ["actual upload"])) {echo "successfully uploaded" $ _FILES ["realupload"] ["error"]; } And {resonate "files not set"; }? & Gt;   
  • The PHP file is just a test file to check if the upload is done
  • Never set the output files
  • Warning is not run in the AJAX data function, I'm not sure that it should be
  • Trying to create a multi file uploader

    Could it be Do with the server? There has already been uploaded to a forum which allows to upload itself, so I do not think this is the case, but I'm not sure.

    Thank you!

    Edit: Friends, thanks for the link, but now you can upload files with HTML5 and XmlHttpRequest2 objects and I'm trying to understand it.

    It is not possible to upload a file using AJAX.

    You have to use an iframe to upload files. Therefore, you can use the iframe for asynchronous uploads (like AJAX, but its not ajax).

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -