search

Home  >  Q&A  >  body text

How to upload php images and forms together with ajax?

Is the image and form uploaded together through ajax? I don’t know how to upload them together? I uploaded the image separately using formdata, but I don’t know how to associate it with the form submission?

PHP中文网PHP中文网2709 days ago903

reply all(4)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-23 09:13:57

    Written by myself

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-23 09:13:57

    var blob = new Blob([this.response], { type: " text/plain" });
                var xhr1 = new XMLHttpRequest();
                xhr1.open("POST", url, true);
                xhr1.onreadystatechange = function (e) {
                    
                };
                var formData = new FormData();
                formData.append("File", blob, fileName);
                formData.append("MarketPlace", "");
                formData.append("SignInEmail", "");
                formData.append("RequestDate","");
                xhr1.send(formData);

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-23 09:13:57

    https://developer.mozilla.org...

    reply
    0
  • PHP中文网

    PHP中文网2017-06-23 09:13:57

    I also thought about it (unfortunately not) and looked at the picture on Baidu (this is for java but the idea is the same, which is to use ajax to do the submit operation of the form. In this way, in the background or get a $ _FILE global variable. . I won’t post the details) (The original link is below)

    http://blog.csdn.net/dsl81572...

    Hope it helps you. Thank you

    reply
    0
  • Cancelreply