Re: form FILE input?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On July 24, 2020 8:22:44 PM UTC, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:
>Hello;
>
>I have been working on a project to work
>up a module in javascript for the sake of
>reading from input fields and converting
>them to a form with hidden fields.
>
>When the form with the hidden fields is
>submitted, the server will process the 
>$_POST vars.
>
>But what if the page with the input
>elements available for the use to fill in
>has a file input field? The server has to
>see $_FILE input set for the upload to take 
>place.
>
>So, the question is:
>How is the $_FILE variable established?
>Is it the enctype setting in the form itself
>or is it the presence of the file field explicitly?
>
>This is an issue because if I convert the file
>input to hidden fields will the server see $_FILE
>input?
>
>Perhaps this is beyond the scope of this list.
>If so, Thank you for attention
>JK
>
>If not
>
>Thank you for you time and attention
>JK 

If the file input fields are set as hidden on the browser, then the browser won't ever send any file data whatsoever. What would be the use case for such an interface? How would the user be expected to upload anything with it?

As for the PHP side, I believe it populates the $_FILE array based on the forms' verb (e.g. POST), the encoding (enctype), and the presence of certain types of POST body data (set by the browser). You could test this out with different types of cURL requests made to your PHP script.

Thanks,
Ash




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux