File upload Can';t将文件上载到phalcon应用程序
上面是使用phalcon框架使用表单数据上传图像的代码。我已经用postman测试了这段代码,但是有一个问题。 它的输出是icon-testing.png 6773 图像名称和图像大小 但文件未上载到文件文件夹。 已经尝试使用我的linux ubuntu/var/www/html/myapp/files的完整路径了 仍然无法上传。 已在chmod 755文件文件夹中 和chown:www-data和chown-my-username-that-html文件夹。 如果这是因为错误的权限,我想知道如何解决这个问题。 谢谢。File upload Can';t将文件上载到phalcon应用程序,file-upload,image-uploading,phalcon,File Upload,Image Uploading,Phalcon,上面是使用phalcon框架使用表单数据上传图像的代码。我已经用postman测试了这段代码,但是有一个问题。 它的输出是icon-testing.png 6773 图像名称和图像大小 但文件未上载到文件文件夹。 已经尝试使用我的linux ubuntu/var/www/html/myapp/files的完整路径了 仍然无法上传。 已在chmod 755文件文件夹中 和chown:www-data和chown-my-username-that-html文件夹。 如果这是因为错误的权限,我想知道如
通过更改其他访问权限解决:可以创建和删除文件。
moveto()
为操作结果返回布尔值。尝试var_dump
it,看看它是否正常。@NikolayMihaylov it ok。。我发现文件夹访问必须赋予访问读写权限才能上传到其他用户。谢谢..你的问题已经解决了,是权限问题吗?如果是这样,请回答您的问题,甚至将其关闭,这样其他人就不会浪费时间来测试和回答:)
public function profilePictureAction()
{
// Check if the user has uploaded files
if ($this->request->hasFiles()) {
// Print the real file names and sizes
foreach ($this->request->getUploadedFiles() as $file) {
// Print file details
echo $file->getName(), " ", $file->getSize(), "\n";
// Move the file into the application
$file->moveTo('files/' . $file->getName());
}
}
}