How can I upload a file using jquery's $.ajax function with json and php

后端 未结 8 2289
旧巷少年郎
旧巷少年郎 2020-12-01 23:17

I am trying to upload a file using jQuery\'s $.ajax function but didn\'t get any output. Somebody please help me to solve this. I don\'t know if this script is

相关标签:
8条回答
  • 2020-12-01 23:50

    Please use plugin for this.
    In my opinion this plugin is better solution for this.You don't need to remember all options etc.Just replace your 'ajax' to 'ajaxForm'.

    Please read examples ,below
    http://jquery.malsup.com/form/#ajaxForm

    0 讨论(0)
  • 2020-12-01 23:51

    Another option would be to base64 encode the file contents and send it as a string, decoding it at the back-end.

    0 讨论(0)
提交回复
热议问题