示例#1
0
 function add()
 {
     // make a new $form object
     $form = new FormHandler();
     // permit editing
     $form->PermitEdit();
     echo "<span class=\"pageHeading\">Add files</span><BR><BR>";
     $form->TableSettings('100%', 0, 1, 2, 'font-family:Verdana;font-size:10px;border: 1px solid grey');
     // upload config
     $config = array('path' => '../files/', 'type' => 'jpg jpeg png gif', 'exists' => 'rename', 'size' => '1000000');
     // uploadfield
     $form->uploadField('Image', 'image', $config);
     // save the resized image as...
     // MAKE SURE THAT THIS DIR EXISTS!
     $saveAs = UPLOAD_DIR . '/thumbs';
     // resize the image
     //echo $saveAs;
     $form->imageResize('image', $saveAs, UPLOAD_RESIZE_WIDTH);
     $form->SubmitBtn("Opslaan", false, "Annuleren");
     // what to do after saving ?
     $form->OnCorrect("doRun");
     // flush the form
     $form->FlushForm();
     // 'commit after form' function
 }