Home  >  Q&A  >  body text

Ajax-fetched page cannot use input type="file" tag?

I get the form page through Ajax.
The following is the form code:

    <form  method="post" enctype="multipart/form-data" class="form-horizontal">
        <p class="form-group" style="margin-left:0px;">
            <label for="file">注:选择头像文件尽量小于2M</label>
            <input id="headPortraitFile" type="file" name="portrait"> 
        </p>
        <button id="headPortraitSubmit" type="button" class="btn-sm btn-primary">上传头像</button>
    </form>

But the input type="file" in this form cannot directly select the file in the browser, let alone submit the file. Do not know what is the reasons of that? I haven't been able to solve it in the past two days. Please ask for help! ! !

PHP中文网PHP中文网2710 days ago517

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:28:40

    Hmm, I don’t see any problems with the form page. Is there something wrong with loading and rendering this code after getting it?

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:28:40

    I tried it, dynamically adding input can select files. How did you add it to the page?

    reply
    0
  • Cancelreply