PHP Classes

htmlForm File input

Recommend this page to a friend!

      HtmlForm PHP 5  >  All threads  >  htmlForm File input  >  (Un) Subscribe thread alerts  
Subject:htmlForm File input
Summary:result array does not show files added in file input field
Messages:8
Author:w. studer
Date:2011-12-19 16:41:08
Update:2013-01-10 15:52:57
 

  1. htmlForm File input   Reply   Report abuse  
Picture of w. studer w. studer - 2011-12-19 16:41:08
Hi

I downloaded the 0.85 beta version and tried it out.
When using the file input box, I loaded a file into, then I triggered submit.

In the result array it is saying
[file1] => no file selected
[save] =>
[imgsave] => 1

Something wrong ?
Where is my "file" ?

Thx and best regards
Wolfgang

  2. Re: htmlForm File input   Reply   Report abuse  
Picture of Sebastian Schlapkohl Sebastian Schlapkohl - 2011-12-19 16:55:26 - In reply to message 1 from w. studer
The resultset is a streamlined version of the $_REQUEST-Array, which does not contain any file-information. You will find all uploaded files in the $_FILE-array after submitting.

But I have to admit that the return value of file fields can be irritating. Since I'm currently working on the next iteration and wanted to add a file-field-validator in the process I think I'll gonna fix that as well, while being at it. The valueSet-entry should at least contain the filename if the upload succeeded.

Thanks for the feedback!

  3. Re: htmlForm File input   Reply   Report abuse  
Picture of w. studer w. studer - 2011-12-27 11:02:40 - In reply to message 2 from Sebastian Schlapkohl
Hi

thanks a lot.
Got it :D

Another question: How do I set an "onClick" Event on a button ?

  4. Re: htmlForm File input   Reply   Report abuse  
Picture of Sebastian Schlapkohl Sebastian Schlapkohl - 2011-12-27 11:15:30 - In reply to message 3 from w. studer
You can use

->setJsEventHandler('onclick', 'alert(\'onclick-test\');')

to set up any native JS-Eventhandler accordingly.

PS: in the coming version this method is likely to be renamed to setJavascriptEventHandler, to keep the naming consistent with Javascript-Validation. Just for people who stumble upon this info later on.

  5. Re: htmlForm File input   Reply   Report abuse  
Picture of w. studer w. studer - 2011-12-27 11:35:53 - In reply to message 4 from Sebastian Schlapkohl
Thanks a lot again.

Got it in meanwhile too.
After ... I've slightly modified your classes by adding " . PHP_EOL" behind </div> and end of inputs ...
Makes source and due to issue findings a little easier ;-)

Thanks
Wolfgang

  6. Re: htmlForm File input   Reply   Report abuse  
Picture of Sebastian Schlapkohl Sebastian Schlapkohl - 2011-12-27 11:44:12 - In reply to message 5 from w. studer
I barely ever look at vanilla HTML anymore, just through the Firebug-lens, but you're right I didn't really care about the source formatting of the form. Didn't strike me as important till now. :D

  7. Re: htmlForm File input   Reply   Report abuse  
Picture of w. studer w. studer - 2011-12-27 11:50:08 - In reply to message 6 from Sebastian Schlapkohl
There are much more important things than pretty source code, you're absolutly right.

But sometimes, pretty code is helpfull .....

Thanks anyhow for very quick response.

Wolfgang

  8. Re: htmlForm File input   Reply   Report abuse  
Picture of w. studer w. studer - 2013-01-10 15:52:57 - In reply to message 4 from Sebastian Schlapkohl
just noticed that in v0.99 setJavascriptEventHandler should be used ;-)