Re: form FILE input?

From: Date: Sat, 25 Jul 2020 16:32:31 +0000
Subject: Re: form FILE input?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-327242@lists.php.net to get a copy of this message
> On Jul 25, 2020, at 5:03 AM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote: > > > > On July 24, 2020 8:22:44 PM UTC, Jeffry Killen <jekillen@prodigy.net> 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 Thank you for your reply JK

« previous php.general (#327242) next »