search

Home  >  Q&A  >  body text

When laravel uses ajax and formData() to upload files, $request->file() cannot obtain the file information. What should I do?

Using $_FILES can get information, but I want to use laravel's $request to get the information and process it. Does anyone have a solution?

给我你的怀抱给我你的怀抱2744 days ago1094

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-31 10:33:43

    Print $request->headers and see what the Content-Type sent by ajax is. Generally, the Content-Type is wrong.

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-31 10:33:43

    If the file is cross-domain, the file may not be received. I don’t know what your specific situation is.

    reply
    0
  • Cancelreply