Modified:
trunk/Classes/Phaux-render/WHHtmlCanvas.php
trunk/Classes/Phaux-render/phaux-render.php
trunk/Classes/Phaux-test/WHFormTest.php
trunk/HtmlRoot/phaux.php
Log:
File Uploads
Modified: trunk/Classes/Phaux-render/WHHtmlCanvas.php
==============================================================================
--- trunk/Classes/Phaux-render/WHHtmlCanvas.php (original)
+++ trunk/Classes/Phaux-render/WHHtmlCanvas.php Thu Oct 11 06:11:49 2007
@@ -69,6 +69,10 @@
public function passwordInput(){
return $this->constructTagWithClass("WHPasswordInputTag");
}
+ public function fileInput(){
+ return $this->constructTagWithClass('WHFileInputTag');
+ }
+
public function submitButton(){
return $this->constructTagWithClass("WHSubmitButtonTag");
}
Modified: trunk/Classes/Phaux-render/phaux-render.php
==============================================================================
--- trunk/Classes/Phaux-render/phaux-render.php (original)
+++ trunk/Classes/Phaux-render/phaux-render.php Thu Oct 11 06:11:49 2007
@@ -32,3 +32,4 @@
include("WHImageTag.php");
include('WHTextAreaTag.php');
include('WHStyleTag.php');
+include('WHFileInputTag.php');
Modified: trunk/Classes/Phaux-test/WHFormTest.php
==============================================================================
--- trunk/Classes/Phaux-test/WHFormTest.php (original)
+++ trunk/Classes/Phaux-test/WHFormTest.php Thu Oct 11 06:11:49 2007
@@ -4,6 +4,7 @@
protected $firstName = "";
protected $lastName = "";
protected $sex = "Female";
+ protected $fileContents;
public function firstName(){
return $this->firstName;
@@ -44,6 +45,11 @@
}
+ public function fileHandle($aPHPFile){
+ $this->fileContents = $aPHPFile;
+ return $this;
+ }
+
public function renderContentOn($html){
$cont = $html->headingLevel(1)->
with($this->firstName." ".$this->lastName. " -- ".$this->sex);
@@ -59,6 +65,17 @@
$html->br().
$html->submitButton()->callback($this,'submitButton')->value("Submit!")
);
+
+ $cont .= $html->form()->enctype("multipart/form-data")->with(
+ $html->bold('File Test:').
+ $html->br().
+ $html->fileInput()->callback($this,'fileHandle').
+ $html->br().
+ $html->submitButton()->callback($this,'submitButton')->value("Submit!")
+ ).
+ $html->bold('The Contents of the File:').
+ $html->br().
+ $html->text(print_r($this->fileContents,TRUE));
return $cont;
}
Modified: trunk/HtmlRoot/phaux.php
==============================================================================
--- trunk/HtmlRoot/phaux.php (original)
+++ trunk/HtmlRoot/phaux.php Thu Oct 11 06:11:49 2007
@@ -90,14 +90,12 @@
*/
if(isset($_REQUEST["_r"])){
-
$_SESSION[$app]['session']->restoreRegistry($_REQUEST["_r"]);
}
$REDIRECT = FALSE;
if(isset($_REQUEST["_k"])){
- //var_dump($_SESSION[$app]['session']);
if(is_object($_SESSION[$app]['session']->callbackByKey($_REQUEST["_k"]))){
$_SESSION[$app]['session']->callbackByKey($_REQUEST["_k"])->run();
}
@@ -105,8 +103,20 @@
}
-if(isset($_REQUEST["_i"]) && is_array($_REQUEST["_i"])){
- foreach($_REQUEST["_i"] as $key => $value){
+if(isset($_FILES['_i']) && is_array($_FILES['_i'])){
+
+ foreach($_FILES['_i']['error'] as $key => $file){
+ $_REQUEST['_i'][$key] = array('name'=>$_FILES['_i']['name'][$key],
+ 'type'=>$_FILES['_i']['type'][$key],
+ 'tmp_name'=>$_FILES['_i']['tmp_name'][$key],
+ 'error'=>$_FILES['_i']['error'][$key],
+ 'size'=>$_FILES['_i']['size'][$key]);
+ }
+ ksort($_REQUEST['_i']);
+}
+
+if(isset($_REQUEST['_i']) && is_array($_REQUEST['_i'])){
+ foreach($_REQUEST['_i'] as $key => $value){
//var_dump($_SESSION[$app]['session']);
if(is_object($_SESSION[$app]['session']->callbackByKey($key))){
$_SESSION[$app]['session']->callbackByKey($key)->runWithArgument($value);