.edi、.seq 和 .xls 的格式
Formats for .edi, .seq and .xls
我正在使用 Symfony 的表单生成器,我为表单创建的 class 如下所示:
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
class Upload
{
/**
* @Assert\File(
* maxSize = "4000k",
* mimeTypes = {"text/plain", "text/xml", "application/xml", "text/csv",
* "application/EDI-consent", "application/EDIFACT", "application/EDI-X12"
* "application/vnd.mseq", "application/json-seq",
* "application/vnd.sealed-xls",
* "application/pdf", "application/x-pdf",
* "application/zip"},
* mimeTypesMessage = "Please upload a valid format file"
* )
* @var file
*/
protected $file;
...
我需要接受接下来的扩展:
'txt,dat,xml,csv,edi,seq,xls,pdf,zip'
这样就够了吗?还有什么要补充的吗?我有什么问题吗?
Symfony 文档推荐从这里获取结果:
https://www.iana.org/assignments/media-types/media-types.xhtml
我认为它应该可以正常工作。也许你应该添加 application/octet-stream 和 zz-application/zz-winassoc-dat 来匹配 dat file extension。并且......用不同的文件测试你的代码,看看它是否有效。
我正在使用 Symfony 的表单生成器,我为表单创建的 class 如下所示:
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
class Upload
{
/**
* @Assert\File(
* maxSize = "4000k",
* mimeTypes = {"text/plain", "text/xml", "application/xml", "text/csv",
* "application/EDI-consent", "application/EDIFACT", "application/EDI-X12"
* "application/vnd.mseq", "application/json-seq",
* "application/vnd.sealed-xls",
* "application/pdf", "application/x-pdf",
* "application/zip"},
* mimeTypesMessage = "Please upload a valid format file"
* )
* @var file
*/
protected $file;
...
我需要接受接下来的扩展: 'txt,dat,xml,csv,edi,seq,xls,pdf,zip'
这样就够了吗?还有什么要补充的吗?我有什么问题吗?
Symfony 文档推荐从这里获取结果:
https://www.iana.org/assignments/media-types/media-types.xhtml
我认为它应该可以正常工作。也许你应该添加 application/octet-stream 和 zz-application/zz-winassoc-dat 来匹配 dat file extension。并且......用不同的文件测试你的代码,看看它是否有效。