marmelab / marmelab/ng-admin

Wrong file name in file type when uploading

Open
#856 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
3.9k
Forks
703
PR merge metrics
No merged PRs in 30d

Description

Hey,

``` javascript
nga.field('image', 'file').uploadInformation({
'url': imageUrl,
'headers': {'Authorization': token},
'apifilename': 'image'
}),
```

In the request the name property has a wrong value :

```
Content-Disposition: form-data; name="file"; filename="toto.jpg"
```

It should be "image".
The html markup of the input has the correct value:

``` html

```

I can't find the problem, ng-admin seems to correctly pass the filename to ng-file-upload.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the upload using the JavaScript snippet and compare the input's name="image" with the multipart request's name="file". Trace how ng-admin passes apifilename to ng-file-upload, then verify that the request uses image while retaining the uploaded filename.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.