umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

Error upload file: The specified file type has been disallowed by the administrator #49

Closed landlogicit closed 1 year ago

landlogicit commented 1 year ago

Describe the bug I have this error when i upload image file.

On Startup.cs i have this code :

.AddFieldset("Media", fieldsetConfig => fieldsetConfig .AddField(p => p.Avatar).SetDataType("Upload File") )

Steps To Reproduce Steps to reproduce the behavior:

  1. Go to 'Repositories'
  2. Click on 'Person'
  3. Select a person
  4. Upload image on Avatar property
  5. Error show red: The specified file type has been disallowed by the administrator

Environment (please complete the following information):

mattbrailsford commented 1 year ago

What's the file type of your image?

landlogicit commented 1 year ago

jpg

mattbrailsford commented 1 year ago

Hmm, that should be supported really. The allowed file types is really run by Umbraco as it's their property editor that is being reused so it should be using Umbraco's mechanisms for restricting file types, but I would have thought jpg should be fine

landlogicit commented 1 year ago

look Animation

mattbrailsford commented 1 year ago

Have you configured the file uploads data types "Accepted file extensions"?

image

landlogicit commented 1 year ago

Yes. Error continue to show

mattbrailsford commented 1 year ago

What is the exact extension of your file (you have extensions turned off in your video so I can't tell) and what is the exact config of your file upload field.

landlogicit commented 1 year ago

My config on startup.cs:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddUmbraco(_env, _config)
                .AddBackOffice()
                .AddWebsite()
                .AddKonstrukt(cfg => {
                    cfg.AddSectionAfter("media", "Repositories", sectionConfig => sectionConfig
                        .Tree(treeConfig => treeConfig
                            .AddCollection<Persona>(x => x.Id, "Persona", "Persone", "A person entity", "icon-umb-users", "icon-umb-users",
                                collectionConfig => collectionConfig
                                .SetRepositoryType<PersonRepository>()
                                .SetNameProperty(p => p.Nome)
                                .ListView(listViewConfig => listViewConfig
                                    .AddField(p => p.TitoloLavoro).SetHeading("Job Title")
                                    .AddField(p => p.Email)
                                )
                                .Editor(editorConfig => editorConfig
                                    .AddTab("General", tabConfig => tabConfig
                                        .AddFieldset("General", fieldsetConfig => fieldsetConfig
                                            .AddField(p => p.TitoloLavoro).MakeRequired()
                                            .AddField(p => p.Eta)
                                            .AddField(p => p.Email).SetValidationRegex("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+")
                                            .AddField(p => p.Telefono).SetDescription("inc area code")
                                        )
                                        .AddFieldset("Media", fieldsetConfig => fieldsetConfig
                                            .AddField(p => p.Avatar).SetDataType("Upload File")
                                        )
                                    )
                                )
                                .AddSearchableProperty(x=>x.Nome)
                                .AddFilterableProperty(x=>x.Nome )
                            )
                        )
                    );

                })
                .AddComposers()
                .AddPersone()
                .Build();
        }
mattbrailsford commented 1 year ago

This isn’t what I meant. You are pointing to the file upload data type, but I want to see the data types config in the settings section in the back office

landlogicit commented 1 year ago

look Animation2

mattbrailsford commented 1 year ago

So yea, that’s likely your problem. You are supposed to configure that, adding the file extensions you want to allow. Because your list is empty, it’s probably refusing everything.

landlogicit commented 1 year ago

If I upload an image to a page I don't get any errors. The image is saved No without putting any file extension as you have seen in the content pages I can upload photos. Animation3

mattbrailsford commented 1 year ago

Ok, I’ll have to take a closer look next week

landlogicit commented 1 year ago

ok. thank you.

mattbrailsford commented 1 year ago

Ok, I've managed to find the issue. I've uploaded a fix to our unstable nuget feed at https://nuget.outfield.digital/unstable/v3/index.json if you want to test the v1.6.4-beta0001 that is on there and confirm this fixes the issues for you, that would be great.

landlogicit commented 1 year ago

i test and show this error on save : Failed to save Person: Exception has been thrown by the target of an invocation.

landlogicit commented 1 year ago

Good Job. I tested your release version 1.6.4 and now i have no errors after uplad. All saved. Thanks you.