Uncaught Unknown file table name: "" with multiple upload

Uncaught Unknown file table name: "" with multiple upload

elherztelherzt Posts: 14Questions: 3Answers: 0

I'm triying to do a multiple upload with C#, I can save images well, but when reload page and try to edit, it says "Uncaught Unknown file table name: image". All data is saved properly on db.

This is my controller

DtResponse response = new Editor(db, "Doctor_Configs", "id")
                    .Model<DoctorConfigModel>("Doctor_Configs")
                    .Model<UserModel>("Users")
                    .MJoin(new MJoin("image")
                        .Link("Doctor_Configs.id", "Configs_Images.config_id")
                        .Link("image.id", "Configs_Images.image_id")
                        .Field(
                        new Field("id")
                            .Upload(
                           new Upload(request.PhysicalApplicationPath + @"uploads\__ID____EXTN__")
                                .Db("image", "id", new Dictionary<string, object>
                                {
                                    {"fileName", Upload.DbType.FileName},
                                    {"webPath", Upload.DbType.WebPath},
                                    {"systemPath", Upload.DbType.SystemPath},
                                })
                                .Validator(Validation.FileSize(500000, "Max file size is 500K."))
                                .Validator(Validation.FileExtensions(new[] { "jpg", "png", "gif" }, "Please upload an image."))
                                )
                        )
                    )
                    .LeftJoin("Users", "Users.doctor_id", "=", "Doctor_Configs.id")
                    .Where("Users.uId", user.uId, "=")
                    .Debug(true)
                    .Process(request)
                    .Data();

and this is my js code that doesn't work

{
                    label: "Logos",
                    name: "image[].id",
                    type: "uploadMany",
                    display: function (fileId, counter) {
                        return '<img src="' + editor.file('image', fileId).web_path + '"/>';
                    },
                    noFileText: 'No images'
                }

Answers

  • elherztelherzt Posts: 14Questions: 3Answers: 0

    Everything works fine the first time, I can add, edit or remove images without problems, but when I reload the page, the files object comes empty from server, images and data are saved properly, just can't display it on client side.

  • allanallan Posts: 61,450Questions: 1Answers: 10,055 Site admin

    Uncaught Unknown file table name: image

    I'm not actually sure where that error message is coming from I'm afraid - there isn't such a string in the libraries.

    Could you show me the full backtrace of the error message? Also when you say you reload and edit, is that just updating one of the other fields, or are you modifying the images?

    Thanks,
    Allan

  • elherztelherzt Posts: 14Questions: 3Answers: 0

    Hi Allan, this error appears on browser console, on the dataTables.editor.js on line 147 when I select the row and click on button edit, the message appears so modal is not showed and button stay loading, I can't edit anything

    I uploaded debug https://debug.datatables.net/uqejoj

  • allanallan Posts: 61,450Questions: 1Answers: 10,055 Site admin

    Thanks for the debug trace - it shows the initial data loaded from the server contains:

    "files": {},
    

    Which is why the files method is throwing an error. Why that is happening... I'm not 100% sure I'm afraid.

    Is your image table in the database actually called image? I ask as your convention appears to be to capitalise the first letter. I'm not sure that would cause the issue though.. Also what version of the Editor dll are you using?

    Thanks,
    Allan

  • elherztelherzt Posts: 14Questions: 3Answers: 0

    Hi Allan, yes it was called "image", I change the name to "Image" in order to match with naming convention and make all necesary changes on controller and view, and still have same error. I'm using version 1.8.0.0

  • allanallan Posts: 61,450Questions: 1Answers: 10,055 Site admin

    Could you try updating to 1.9.2 which is the current release please?

    Thanks,
    Allan

  • elherztelherzt Posts: 14Questions: 3Answers: 0

    I definitely feel like a newbie, I think that's the first thing I should have tried, now it works, thanks a lot

This discussion has been closed.