$core = '../../xajax_core'; require_once $core . '/xajax.inc.php'; $xajax = new xajax(); require_once '../../xajax_plugins/response/swfupload/swfupload.inc.php'; $xajax->configure("javascript URI", "../../"); $xajax->configure("responseType", "XML"); $xajax->register(XAJAX_FUNCTION, "uploader", array("mode" => "'SWFupload'", "SWFform" => "'upload_form'")); $xajax->register(XAJAX_FUNCTION, "transform"); $xajax->register(XAJAX_FUNCTION, "transfield"); $xajax->register(XAJAX_FUNCTION, "destroyfield"); $xajax->register(XAJAX_FUNCTION, "sync_test", array('mode' => "'synchronous'")); $xajax->register(XAJAX_FUNCTION, "destroyform"); $_SESSION['foo']++; $xajax->processRequest(); // This is dev code, you don't need these lines for using the SWFupload plugin. $xajax->autoCompressJavaScript(null, true); $xajax->autoCompressJavaScript('../../xajax_plugins/response/swfupload/swfupload.xajax.js', true); $xajax->autoCompressJavaScript('../../xajax_plugins/response/swfupload/swfupload.js', true); function transfield() { $objResponse = new xajaxResponse(); $foo = "\n\t\t\t<input type='text' name='testfieldtext' value='foo' /><br />\n\t\t\t<input type='file' name='filetest' id='filetest' />\n\t\t"; $objResponse->assign('fieldtest', 'innerHTML', $foo); $objResponse->clsSwfUpload->transField('filetest', array("file_types" => "*.jpg;*.gif;*.png;", "file_types_description" => "Image Files or mp3", "file_size_limit" => "5 MB", "upload_complete_handler" => "function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}", "post_params" => array("PHPSESSID" => session_id())), true); return $objResponse; } function destroyField() { $objResponse = new xajaxResponse(); $objResponse->clsSwfUpload->destroyField('filetest'); $objResponse->assign('fieldtest', 'innerHTML', '');
require_once "../xajax_core/xajax.inc.php"; function testForm($formData) { $objResponse = new xajaxResponse(); $objResponse->alert("formData: " . print_r($formData, true)); $objResponse->assign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); return $objResponse; } $xajax = new xajax(); //$xajax->configure("debug", true); $xajax->register(XAJAX_FUNCTION, "testForm"); $xajax->processRequest(); $xajax->configure('javascript URI', '../'); #$xajax->configure('useUncompressedScripts',true); $xajax->autoCompressJavaScript(null, true); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Form Submission Test| xajax Tests</title> <style type="text/css"> fieldset > div { border : 1px solid gray; padding : 5px; background-color : white; } </style>