uncaught exception: Unknown file id

uncaught exception: Unknown file id

sarath_surisettysarath_surisetty Posts: 54Questions: 13Answers: 0

Hi Allan
further fixing edit :upload many with ref: https://datatables.net/forums/discussion/50933/datatable-with-uploadmany-uncaught-exception-unknown-file-table-name

After fixing the issue of edit for upload many in edit i am facing issue for "Add"

js code:

  {
                    label: "Images:",
                    name: "propertyImages[].imageId",
                    type: "uploadMany",
                    ajax: 'propertyImage/add',
                    display: function ( imageId, counter ) {
                        return '<img src="'+propertyEditor.file( 'propertyImages', imageId ).imagePath+'"/>';
                    },
                    noFileText: 'No images'
                },

js response:

{"upload":{"id":2},"files":{"files":{"2":{"filename":"30e9b4f2-caa1-4f98-a495-bfd4e9741023.png","web_path"
:"Temp\30e9b4f2-caa1-4f98-a495-bfd4e9741023.png"}}}}

could you please support in fixing this issue?

screenshot:

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    This part:

    {"files":

    Is incorrect - it should be:

    {"propertyImages":
    

    For your use case, since you are looking up data from a table called propertyImages.

    Allan

  • sarath_surisettysarath_surisetty Posts: 54Questions: 13Answers: 0

    hi allan

    your guess was correct also i corrected web_path key.
    -> is it possible to pass base64 string and form image with this approach instead of passing the image path?

    thanks
    sarath

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi Sarath,

    Yes, you could include a base64 string and use the following to display it:

    return '<img src="'+propertyEditor.file( 'propertyImages', imageId ).base64+'"/>';
    

    Allan

This discussion has been closed.