how to read FormData object in php

后端 未结 1 1133
孤城傲影
孤城傲影 2020-12-10 11:14

Hello everyone I am posting a sample code in which I am uploading a file using Ajax JQuery. All thing works fine but I want to read the file content in my php code. So what

相关标签:
1条回答
  • 2020-12-10 11:56

    The first argument you pass to FormData.append() is the name of the form element that is passed to the server. So data.append('file', alpha) in your case is equivalent to <input type="file" name="file"> - you passed 'file' to append() so 'file' is your input name.

    You should find your stuff in $_POST['file'] and $_FILES['file']. Next time try var_dump($_POST); after submit to see the array. :)

    Learn about file uploads in php here: http://php.net/manual/en/features.file-upload.php

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