Magento2 如何在magento 2管理表单中显示上载的文件名?
我已经在管理员中创建了文件上载,并在浏览文件后成功上载。但上传文件后无法显示所选文件名。在firebug中,我可以看到value属性中的输入标记包含文件的路径,但它可以看到“未选择任何文件”。请参见下面的屏幕截图 文件上传代码如下所示Magento2 如何在magento 2管理表单中显示上载的文件名?,magento2,Magento2,我已经在管理员中创建了文件上载,并在浏览文件后成功上载。但上传文件后无法显示所选文件名。在firebug中,我可以看到value属性中的输入标记包含文件的路径,但它可以看到“未选择任何文件”。请参见下面的屏幕截图 文件上传代码如下所示 $path = $this->fileSystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('uploadfolder'); $filepath =
$path = $this->fileSystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('uploadfolder');
$filepath = $path.'/'.$_FILES['uploadfile']['name'];
if(file_exists($filepath) != 1)
{
$uploader = $this->uploaderFactory->create(['fileId' => 'uploadfile']);
$uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png','doc','pdf','xls','docx','zip','mp4','avi','mp3','txt','xlsx','vob']);
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$uploader->save($path);
return $path;
}
else
{
return 0;
}
请帮帮我,我哪里做错了
谢谢