NAME='upload_form';
$form->METHOD='POST';
$form->ACTION='';
$form->ENCTYPE='multipart/form-data';
$form->debug='error_log';
$form->ResubmitConfirmMessage=
'Are you sure you want to submit this form again?';
$form->AddInput(array(
'TYPE'=>'file',
'NAME'=>'userfile',
'ValidateAsNotEmpty'=>1,
'ValidationErrorMessage'=>
'It was not specified a valid file to upload'
));
$form->AddInput(array(
'TYPE'=>'submit',
'VALUE'=>'Upload',
'NAME'=>'doit'
));
$form->AddInput(array(
'TYPE'=>'hidden',
'NAME'=>'MAX_FILE_SIZE',
'VALUE'=>1000000
));
$form->AddInput(array(
'TYPE'=>'custom',
'NAME'=>'upload_progress',
'ID'=>'upload_progress',
'FeedbackElement'=>'feedback',
'FeedbackFormat'=>
'
Uploaded {UPLOADED}B of {TOTAL}B
Remaining time: {REMAINING}
Average speed: {AVERAGE_SPEED}B/s
Current speed: {CURRENT_SPEED}B/s',
'CustomClass'=>'form_upload_progress_class'
));
/*
* Handle client side events on the server side.
* Do not output anything before these lines.
*/
$form->HandleEvent($processed);
if($processed)
exit;
$form->LoadInputValues($form->WasSubmitted('doit'));
$verify=array();
if($form->WasSubmitted('doit'))
{
sleep(1);
if(($error_message=$form->Validate($verify))=='')
$doit=1;
else
{
$doit=0;
$error_message=HtmlEntities($error_message);
}
}
else
{
$error_message='';
$doit=0;
}
if(!$doit)
{
if(strlen($error_message))
{
Reset($verify);
$focus=Key($verify);
}
else
$focus='userfile';
$form->ConnectFormToInput($focus, 'ONLOAD', 'Focus', array());
}
$onload=HtmlSpecialChars($form->PageLoad());
?>
Test for Manuel Lemos' PHP form class
to show upload file progress
Test for Manuel Lemos' PHP form class
to show upload file progress
GetFileValues('userfile',$userfile_values);
?>
The file was uploaded.
Uploaded file path: |
|
Client file name: |
|
File type: |
|
File size: |
|
AddInputPart('upload_progress');
$form->AddInputPart('MAX_FILE_SIZE');
$form->StartLayoutCapture();
$title='Form upload progress test - 1MB maximum size';
$body_template='form_upload_body.html.php';
include('templates/form_frame.html.php');
$form->EndLayoutCapture();
$form->DisplayOutput();
}
?>