Unknown file id 5 in table files with file upload
Unknown file id 5 in table files with file upload

Good day....
Currently working on the file upload section in our tool...
I select an existing row and edit it...then choose a file and upload it for processing...
So what "id" value in the "upload" array is the uploader expecting?
When uploading a file a reference will be entered in pgsql returning the unique fileid
which I use as the "id" value returning to file uploader...
But I see in the console:
uncaught exception: Unknown file id 5 in table files
When I return fixed 0 as id then it is fine...but won't work for multiple files....
thanks in advance
richard
This question has an accepted answers - jump to answer
Answers
This is the JSON I return after file has been uploaded successfully...
{"data":[],"files":{"files":{"1":{"id":"7","filename":"IMG_1419.jpeg","filesize":187277,"icon":"<i class=\"mdi mdi-file-image\"><\/i>.","system_path":"\/var\/www\/order\/html_public\/uploads\/IMG_1419.jpeg"}}},"upload":{"id":"7"}}
What I am missing...it doesn't send any reference to the DT_RowId for the uploaded file...only:
Array
(
[action] => upload
[uploadField] => files[].id
)
Okay...seems I misinterpreted the JSON returned from the example wrong...
So upload is fine with no error messages....and displays nicely then in the dialog:
But how do I know in the file upload handler to which row the files are belonging to?
Hmm..this seems to do the trick for the upload ajax:
Going back to the JSON return - the keys for the inner
files
object should be the id of the entry in the database - i.e.:It looks at the object's keys, not the values inside it.
Allan
You don't. You've got a workaround for edit - but what about create when there is no id yet? The file upload doesn't need to know the host row id, it's the other way around - the host row needs to know the id for the file.
Allan