Symfony 2 文件上传:guessExtension() 不适用于 .docx 文件 [英] Symfony 2 file upload: guessExtension() doesn't work for .docx files

查看:35
本文介绍了Symfony 2 文件上传:guessExtension() 不适用于 .docx 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public function preUpload()
{
    if (null !== $this->file) {
        $this->path = $this->file->guessExtension();

    }
}

这不适用于 .docx 文件.

This doesn't work for .docx files.

我得到一个以myfile"名称存储的文件.-> 无扩展名.

I get a file stored under the name "myfile." -> no extension.

如何处理?

推荐答案

使用

 getExtension()

作为后备?

Symfony API

这篇关于Symfony 2 文件上传:guessExtension() 不适用于 .docx 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆