0

I intend with this gjs to upload files to my web root but the response is always 404. Tried to follow the documentation, but probably missed something, about access permissions?? The files will accumulate fine in the queue and there are upload attempts but each is ending in POST http://localhost:3000/ [HTTP/1.1 404 Not Found 9ms] and File upload failed...:

...
import { UploadFile } from 'ember-file-upload';
import FileQueueService from 'ember-file-upload/services/file-queue';
...
export class DialogUtil extends Component {
  @service('common-storage') z;
  @service intl;
...
  uploadPhoto = async (file) => {
    try {
      const response = await file.upload('/', {accepts: ['image/png', 'image/jpeg', 'image/tiff', 'image/gif']});
    } catch (response) {
      console.error(`File upload failed: ${response}`);
    }
  }
...
 <template>
    <dialog id="dialogUtil" style="width:min(calc(100vw - 2rem),auto);max-width:480px" {{on 'keydown' this.detectEscClose}} {{on 'mousedown' this.detectMouseDown}} {{on 'mouseup' this.detectMouseUp}}>
...
...
            {{#let (fileQueue name='photos' onFileAdded=this.uploadPhoto) as |queue|}}
              Files in queue: {{queue.files.length}}<br>
              {{t 'filesPassed' n=this.nPass}}<br>
              {{t 'filesFailed' n=this.nFail}}<br>
              <label>Choose files
                <input id="imUpLd" type="file" multiple {{queue.selectFile}}>
              </label>
            {{/let}}
...
...
    </dialog>
  </template>
}```

The server is Node express 4.21.2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.