I need to create a server for a multipart / form-data post request submit that sends me a file, and since I have no control over the client side I wanted to know how to receive the file without knowing the name of the field containing the file, in practice the client side is not my property but I still have to receive files from the outside. How can I intercept the request? I have to do everything in php. Is there a way to make a post request by sending a file without a form in php? Although virtually the client sending me the file could be written in any language
To test i wrote a form to send the file in html, I know the form is correct but I don’t know how to intercept the request and read the file server side without referring to the name of the input field
<form action='https://DNS:443/context/NomeComponente?<parametro1>=<valore1>&<parametro2>=<valore2>&…&<parametroN>=<valoreN>' method='post' enctype='multipart/form-data'>
<div class='row'>
<div class='col-25'>
<label for='country'>select file to upload</label>
</div>
<div class='col-75'>
<input type='file' name='fileToUpload' id='fileToUpload'>
</div>
</div>
<div class='row'>
<br>
<center><input type='submit' value='Upload file' name='submit'></center>
</div>
</form>