There is always only one object(latest one) in table.files

There is always only one object(latest one) in table.files

bobobobobobo Posts: 24Questions: 9Answers: 1

Hi

So there may be problem when access table.file( 'files', file_id ).filename, for example, file_id is not the the latest uploaded one.
Below is my site, I cannot upload the second file in new dialog. Could you help have a check? Thanks

http://139.129.211.212:8765/admin/main/index.html#/article.html
"新增" means New, the last field is the uploadMany type

BTW, another issue, I can create record with one file successfully, but I cannot edit it, I think it is the same root cause with above one.

You friend
Gavin

This question has an accepted answers - jump to answer

Answers

  • bobobobobobo Posts: 24Questions: 9Answers: 1
    edited October 2016

    Hi

    In fact, I opened similar ticket before, you said maybe the server response is not right. Below is my server response, it seems the same to that in official demo.

    {
        "data": [],
        "upload": {
            "id": "8a99d2635803c615015803d3fd530001"
        },
        "files": {
            "files": {
                "8a99d2635803c615015803d3fd530001": {
                    "id": "8a99d2635803c615015803d3fd530001",
                    "filename": "8a99d2635803c615015803d3fd530001",
                    "filesize": 2193,
                    "web_path": "/file/8a99d2635803c615015803d3fd530001",
                    "system_path": "/file/8a99d2635803c615015803d3fd530001"
                }
            }
        }
    }
    
  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Hi,

    The response looks very nearly correct. The problem is that at the moment you need to return all of the fields that have previously been uploaded, in addition to the one that was just uploaded.

    Is that something you are able to do by removing the WHERE condition that I presume you have on the query at the moment?

    This is an oversight that will be corrected in Editor 1.6 (although that probably won't be available until December).

    Regards,
    Allan

  • bobobobobobo Posts: 24Questions: 9Answers: 1

    Allan,

    I also thought the server need to response the all files. I found the demo does not do as it, but it works. It is strange to me. I can try as you said firstly, but I have a question, how can server know which files is the related ones need to be returned? The request params from client is like below. Return all history files uploaded may be huge.

    BTW, you said there will be an enhancement in Editor 1.6, does it mean it will works even if server only response the one that was just uploaded?

    ------WebKitFormBoundaryqFjBG2UVY0OOcP9E
    Content-Disposition: form-data; name="action"

    upload
    ------WebKitFormBoundaryqFjBG2UVY0OOcP9E
    Content-Disposition: form-data; name="uploadField"

    files[].id
    ------WebKitFormBoundaryqFjBG2UVY0OOcP9E
    Content-Disposition: form-data; name="upload"; filename="logo 2.png"
    Content-Type: image/png

    ------WebKitFormBoundaryqFjBG2UVY0OOcP9E--

    BR
    Gavin

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    how can server know which files is the related ones need to be returned?

    Currently it can't really. It needs to just dump the entire lot...

    I've sent you a PM discussing this :smile:

    Allan

This discussion has been closed.