本文整理汇总了PHP中UploadField::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::upload方法的具体用法?PHP UploadField::upload怎么用?PHP UploadField::upload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::upload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* Action to handle upload of a single file
*
* @param SS_HTTPRequest $request
* @return SS_HTTPResponse
* @return SS_HTTPResponse
*/
public function upload(SS_HTTPRequest $request)
{
// Find the first set of upload data that looks like it came from an
// UploadField.
// NOTE(Jake): There is only the SecurityID and the 'upload' data as this is done
// in it's own AJAX request, not sent along with all the other data.
foreach ($request->postVars() as $key => $value) {
// todo(Jake): Test SS 3.1 compatibility
// NOTE(Jake): Only tested in SS 3.2, UploadField::upload data may not look like this in 3.1...
if ($value && isset($value['name']) && isset($value['type']) && isset($value['tmp_name'])) {
// NOTE(Jake): UploadField requires this FormField to be the correct name so it can retrieve
// the file information from postVar. So detect the first set of data that seems
// like upload info and use it.
$this->setName($key);
break;
}
}
return parent::upload($request);
}