Reputation: 169
When I am trying to upload multiple images using Umbraco Drag and Drop functioanlity, I am getting No property type exists with alias umbracoFile. I have custom media type Top Banner with alias name banner. When I upload the image, it is using the custom media type as contentTypeAlias. The custom media type doesn't have a property named umbracoFile. So, I need to change this behavior. I need to use default File/Image media type for uploading the image. How I can achieve it?
I have created a new Media Type 'Top Banner'(Alias:Banner) and properties on Banner media type
If I am adding a property umbracoFile(Property Type : FileUpload) into Banner Media type, the files are getting uploaded and no error is coming.
Exception Details:
No property type exists with alias umbracoFile.
Stack Trace:
at Umbraco.Core.IO.MediaFileSystem.GetProperty(IContentBase content, String propertyTypeAlias)
at Umbraco.Core.IO.MediaFileSystem.SetUploadFile(IContentBase content, String propertyTypeAlias, String filename, Stream filestream)
at Umbraco.Core.Models.ContentExtensions.SetValue(IContentBase content, String propertyTypeAlias, String filename, Stream filestream)
at Umbraco.Web.Editors.MediaController.<PostAddFile>d__26.MoveNext()
These are the Media types
Upvotes: 0
Views: 848
Reputation: 169
As per Robert's comment I have updated the \Umbraco\lib\ng-file-upload\ng-file-upload.min.js file(line number 185 for unminified file).
if (h == "Banner") {// my custom media type alias is Banner
var regexp = /(?:\.([^.]+))?$/;
var ext = regexp.exec(a.file.name)[1];
ext = ext.toLowerCase();
var imageExtensions = ["png", "jpeg", "gif","jpg"];
if (imageExtensions.indexOf(ext)>-1) {
h = "Image";
}
var fileExtensions = ["pdf", "doc", "gif", "xls", "xlsx", "odt", "ods", "ppt", "pptx", "txt", "zip", "svg", "csv"];
if (fileExtensions.indexOf(ext) > -1) {
h = "File";
}
console.log(ext);
}
Upvotes: 0
Reputation: 2316
Ok, so. What's happening is that Umbraco tries to determine what the media type is in a couple of ways - first, on the Client side in JavaScript it checks to see what Media Types are allowed in the particular folder you're adding files to.
If you have a recent version of Umbraco (since around November last year), it should be giving you the option to choose which Media Type to upload the files to if you've got more than one allowed type for the folder you're uploading to, otherwise it will silently choose Image
or File
depending on the extension of the file you're uploading.
The error you're getting may indicate that you're choosing the custom Banner
media type while uploading the files, but it may not be set up with the mandatory fields for it to work.
What are your property Aliases? You've only listed the names and the types. My guess is you haven't got the Image Cropper set up with an alias of umbracoFile
, and you should also set up the other media aliases as labels similar to the Image
media type.
Upvotes: 2