Web services rest服务获取yii中的文件参数
嗨,我试着从谷歌邮箱里的邮递员那里获取文件。 我尝试获取文件参数、大小和类型 这就是解决方案的逻辑Web services rest服务获取yii中的文件参数,web-services,rest,yii,Web Services,Rest,Yii,嗨,我试着从谷歌邮箱里的邮递员那里获取文件。 我尝试获取文件参数、大小和类型 这就是解决方案的逻辑 If($_POST) { $document='document_from_postman.docx' $size = file size of $document $tip = file type of $document } $size sent to database. $tip sent to database. 但我不
If($_POST)
{
$document='document_from_postman.docx'
$size = file size of $document
$tip = file type of $document
}
$size sent to database.
$tip sent to database.
但我不知道如何在yii控制器中实现这一点,如何从postman获取键值,我以前从未使用过web服务。如何将postman的文档名放在变量示例中:
$document='document\u from\u postman.docx'您必须使用
$file=cuploaddedfile::getInstance$model,'file'
在你的控制器里。这样就可以得到文件的大小和类型
echo $file->size;
echo $file->type;
写数据库你已经知道我该怎么做了。例如:
$file=CUploadedFile::getInstance($model,'file')
$model->size = $file->size;
$model->type = $file->type;
$model->save()