Coder Social home page Coder Social logo

Comments (6)

volkanceylan avatar volkanceylan commented on June 30, 2024

Actually you can use it with EditorType("MultipleImageUpload"), as editor type attributes are just intellisense helpers. But i'm not sure if multiple upload editor works properly, didn't use it for long time, need to have a look.

from serenity.

ademc avatar ademc commented on June 30, 2024

I tried EditorType attribute usage, editor shown properly but when updating record have an errror:

An exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in Serenity.Data.Entity.dll but was not handled in user code

Additional information: Unexpected token when deserializing row: StartArray

Newtonsoft.Json.JsonSerializationException was unhandled by user code
HResult=-2146233088
Message=Unexpected token when deserializing row: StartArray
Source=Serenity.Data.Entity
StackTrace:
at Serenity.Data.Field.JsonUnexpectedToken(JsonReader reader) in c:\project\Serenity\Serenity.Data.Entity\FieldTypes\Field.cs:line 132
at Serenity.Data.StringField.ValueFromJson(JsonReader reader, Row row, JsonSerializer serializer) in c:\project\Serenity\Serenity.Data.Entity\FieldTypes\StringField.cs:line 83
at Serenity.Data.JsonRowConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in c:\project\Serenity\Serenity.Data.Entity\Row\JsonRowConverter.cs:line 109
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
InnerException:

from serenity.

volkanceylan avatar volkanceylan commented on June 30, 2024

Error you are getting is because MultipleImageUploadEditor sends JSON array to server side by default as field value, and it can't be deserialized to a string field.

Please update Serenity nuget packages to 1.5.1.

I tried making sure MultipleImageUpload works properly in this version.

Then use the ImageUploadEditor attribute like below:

        [ImageUploadEditor(allowMultiple: true, JsonEncodeValue = true)]
        public String ProductImages { get; set; }

And on top of your SaveHandler you should use EmbeddedMultiFileUploadBehaviour instead of EmbeddedFileUploadBehaviour as below:

[EmbeddedMultiFileUploadBehaviour("ProductImages", fileNameFormat: "ProductImage/{1:00000}/{0:00000000}_{2}", copyFilesToHistory: true)]
private class MySaveHandler : SaveRequestHandler<MyRow> {
}

After this it should work.

from serenity.

zehranur avatar zehranur commented on June 30, 2024

I updated serenity packages. I can use ImageUploadEditor . There is no EmbeddedMultiFileUploadBehaviour attribute class. I used EmbeddedFileUploadBehaviour and normally get an error:

Failed to load resource: the server responded with a status of 404 (Not Found)
jquery-2.1.4.js?v=EH--lVW_yI7FyrUkx5D-NA2:8630 POST http://localhost:59837/File/TemporaryUpload 404 (Not Found)

from serenity.

volkanceylan avatar volkanceylan commented on June 30, 2024

Serenity.Web and Serenity.CodeGenerator 1.5.1 packages somehow didn't make it to Nuget gallery, try to update them again please, and rebuild project.

from serenity.

volkanceylan avatar volkanceylan commented on June 30, 2024

Please reopen this if problem still persists.

from serenity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.