I have…
- [x] Read the following guideline: https://docs.squidex.io/01-getting-started/installation/troubleshooting-and-support. I understand that my support request might get deleted if I do not follow the guideline.
 
I’m submitting a…
- [ x] Regression (a behavior that stopped working in a new release) ( I’m unsure but I suspect so )
 - [ ] Bug report
 - [ ] Performance issue
 - [ ] Documentation issue or request
 
Current behavior
I am trying to use the Assets API to upload new files. I am able to create the folder, but when it comes to the files I can’t seem to get past the “Can only upload one file.” error.
I am using Node.JS and referenced the squidex-client-manager project:
setup the Swagger client and force multipart/form-data :
this.squidexApi = await new Swagger({
      url: this.squidexSpecUrl,
      requestInterceptor: (req) => {
        // eslint-disable-next-line no-underscore-dangle
        if (req.body && req.body._currentStream !== undefined) {
          // If a stream is detected, use multipart/form-data
          req.headers['Content-Type'] = 'multipart/form-data';
        } else if (req.body && !req.headers['Content-Type']) {
          req.headers['Content-Type'] = 'application/json';
        }
        req.headers.Authorization = `Bearer ${token}`;
      },
    });
Upload the file:
const createAssetAsync = async (assetUrl, parentId, id, Duplicate) => {
  await client.ensureValidClient();
  const mimeType = findMimeType(assetUrl);
  if (!mimeType) {
    throw new Error(`Invalid content type when looking up mime type for ${assetUrl}`);
  }
  const form = new FormData();
  form.append('file', fs.createReadStream(assetUrl));
  form.append('mimeType', mimeType);
  const res = await client.squidexApi.apis.Assets
      .Assets_PostAsset({ app: client.appName, parentId }, { requestBody: form });
  return res;
}
I’ve been trying variations of this, but no matter what I try I end up with the same error. I’ve also tried without the parentId and manually setting the mime type. Also, I know the multipart/form-data is being applied
Expected behavior
Upload the file successfully
more explicit error messaging.
Minimal reproduction of the problem
see desc
Environment
- [ x] Self hosted with docker
 - [ ] Self hosted with IIS
 - [ ] Self hosted with other version
 - [ ] Cloud version
 
Version: squidex/squidex:local
Browser:
- [ x] Chrome (desktop)
 - [ ] Chrome (Android)
 - [ ] Chrome (iOS)
 - [ ] Firefox
 - [ ] Safari (desktop)
 - [ ] Safari (iOS)
 - [ ] IE
 - [ ] Edge
 
Others:
I saw a minimal example ( codepen? ) on this that you linked to at one point, but I lost it. Do you still have that link? It might help.