php - Strange form reaction when file uploaded -
i have simple form :
<form action="http://localhost/api2/users/teachers/imageupload" method="post" enctype="multipart/form-data" data-ajax="false"> <input type="hidden" name="x-api-key" value="21f5ba3c7ac34c81964f5e49b13b9b65914dhar2"> var1: <input type="number" name="var1" ></br> var2: <input type="number" name="var2" ></br> image: <input type="file" name="img" multiple></br> <input type="submit"> </form>
all should send post request api-key, var1, var2 , image file.
now long form doesn't try send file, works great. when try send image, if sent empty form.
here of backend:(i made default response testing.)
$var1 = $this->post("var1"); $var2 = $this->post("var2"); $this->response(array("error"=> true,"message"=>"missing arguments","data"=>array($var1,$var2,$_files)),500);
response without file:
{ "error": true, "message": "missing arguments", "data": [ "1", "2", [] ] }
response file:
{"error":true,"message":"access denied"}
and if send via postman receive.
{ "error": true, "message": "missing arguments", "data": [ false, false, [] ] }
i'm using codeigniter-restserver restapi
controller. working fine until started uploading files.
does know causing this? thank you.
see size of max_file_size , post_max_size in php.ini file , make them larger or try upload smaller image. had similar problem.
hope helps.
Comments
Post a Comment