PHP Class Form_Field_Upload, atk4
- flash upload. Upload will be carried through by flash.
Mode can be set by
setMode('plain') - plain mode is not available with AJAX form
setMode('iframe')
setMode('flash')
by Default mode is iframe.
allowMultiple(boolean=true)
this function will allow you to specify whether you want user to upload multiple files.
by default, single mode is used
Mode Support.
You can use setModel('filestore/File'); This will use the model for file upload handling. You
can specify your own model, which derives from either filestore\Model_File or filestore\Model_Image
Field value will always contain "id" of uploaded file. If multiple file upload is permitted, field
will contain comma-separated list of IDs.
Example1: Simple use with model
$upl=$form->addField('Upload','myfile_id')
->setModel('filestore/File');
Example2: Customizing field
$upl=$form->addField('Upload','photo_id','Photo')
->setController('filestore/Image')
->allowMultiple(false);
$upl->template->set('after_field','Max size: 500k');
Example3: Specifying inside Model
$model=$this->add('Model_Book');
$model->add('filestore/Field_Image','picture_id');
$this->add('Form')->setModel($model);
Example4: Use of your custom model
显示文件
Open project: atk4/atk4
Public Properties
Public Methods
Method Details
allowMultiple()
public method
convertToBytes()
public method
displayUploadInfo()
public method
getFileError()
public method
getFilePath()
public method
getFileSize()
public method
getFilesizeFieldName()
public method
getOriginalFilenameFieldName()
public method
getOriginalName()
public method
getOriginalType()
public method
getTypeIDFieldName()
public method
getUploadedFiles()
public method
those can be done in flash thingie as well
getVolumeIDFieldName()
public method
* reimplement these functions in your *_Upload class
isUploaded()
public method
uploadComplete()
public method
uploadFailed()
public method
Property Details
$debug public_oe property
$max_file_size public_oe property
public string $mode |
return |
string |
|
$multiple public_oe property
public int|false $multiple |
return |
integer | false |
|