Http Header question

William Prothero prothero at
Tue Jan 19 20:38:39 EST 2016

Dave got me started, but I’m still confused, unfortunately. I am having trouble seeing how the variables and data are passed from the POST command to the php script. What I’m trying to reproduce is:

      $errors= array();
      $file_name = $_FILES['image']['name'];
      $file_size =$_FILES['image']['size'];
      $file_tmp =$_FILES['image']['tmp_name'];
      $expensions= array("jpeg","jpg","png");
      if(in_array($file_ext,$expensions)=== false){
         $errors[]="extension not allowed, please choose a JPEG or PNG file.";
      if($file_size > 2097152){
         $errors[]='File size must be excately 2 MB';
         echo "Success";
      <form action="" method="POST" enctype="multipart/form-data">
         <input type="file" name="image" />
         <input type="submit"/>

I’m familiar with a php script getting variables from lines like:
$tName =  $_POST["name"];

But, in the above example, how do the file variables get sent? I suppose, in the headers? But, I don’t seem to be successful. The file doesn’t seem to be passing to the php. I’m thinking that the image data gets embedded in the header, but I don’t see the file on my server and nothing seems to be getting into the $_FILES variable.

Help?? thanks. 

> On Jan 19, 2016, at 3:55 PM, William Prothero <prothero at> wrote:
> Dave:
> That’s it! I knew there was something like that, but couldn’t remember it. 
> Thanks!
> Bill
>> On Jan 19, 2016, at 3:51 PM, Dave Cragg <dcragg at> wrote:
>> Bill,
>> Take a look at libUrlMultipartForm and libUrlMultipartFormAddPart in the dictionary. There are examples there that might help you.
>> Cheers
>> Dave Cragg

More information about the Use-livecode mailing list