Write a copy of api for ios, but at first you can't catch the file size?.

I wrote an upload photo api for ios to use:

if($_FILES["cover"]["size"] != ""){
    // do....
}else{
    echo "error!";
}
The

counterpart bit is also cover and post matching
, but it just happens to be error!
can"t catch the file size
of the counterparty at all. How do you explain this?
is there anything else I need to configure here or on the other side?

update
whether php can print out Content-Disposition?


POST /test.html HTTP/1.1
Host: example.org
Content-Type: multipart/form-data;boundary="boundary"

--boundary
Content-Disposition: form-data; name="field1"

value1
--boundary
Content-Disposition: form-data; name="field2"; filename="example.txt"

value2
--boundary--

can php print this message?

Mar.04,2021

output the entire array to error.log, with error_log (var_export ($_ FILES,true)); ) and look at its structure.

< hr >

there are still updates. Okay. Try it:

<?php
$postdata = file_get_contents("php://input");
error_log(var_export($postdata, true));

see if you can output the POST request body

Menu