Unable to set form's "name" on file upload #22

Closed
opened 2016-01-15 04:36:51 +00:00 by kfbishop · 4 comments
kfbishop commented 2016-01-15 04:36:51 +00:00 (Migrated from github.com)

The FileItem object set the alias to "file", and there is no easy way to change this. This makes it impossible to have a general backend that can determine action of the uploaded file based on the "name=file" form data.

I currently have to file drop's on my view, each with a distinct role. But, both are uploaded with a name of "file", so I don't know which is which.

Suggest adding an actual "name" input to the ng2-file-drop that can override the "alias" field for that item.

The FileItem object set the alias to "file", and there is no easy way to change this. This makes it impossible to have a general backend that can determine action of the uploaded file based on the "name=file" form data. I currently have to file drop's on my view, each with a distinct role. But, both are uploaded with a name of "file", so I don't know which is which. Suggest adding an actual "name" input to the ng2-file-drop that can override the "alias" field for that item.
adeteejay commented 2016-01-17 19:06:27 +00:00 (Migrated from github.com)

actually what I did to get by this was change
(click)="item.upload()"
to
(click)="item.alias = newname; item.upload()" just pass newname through your component class

actually what I did to get by this was change `(click)="item.upload()"` to `(click)="item.alias = newname; item.upload()"` just pass newname through your component class
kfbishop commented 2016-01-17 21:56:23 +00:00 (Migrated from github.com)

Thx @adeteejay. I ended up just using a custom tokenized upload URL, instead of worrying about the field name. It worked cleaner for my situation, but I like the simplicity of your solution.

Thx @adeteejay. I ended up just using a custom tokenized upload URL, instead of worrying about the field name. It worked cleaner for my situation, but I like the simplicity of your solution.
serhiisol commented 2016-06-06 15:40:19 +00:00 (Migrated from github.com)

I made PR to fix this problem, I hope guys will merge it :)

I made PR to fix this problem, I hope guys will merge it :)
sdornan commented 2016-06-21 15:50:02 +00:00 (Migrated from github.com)

I also have this problem.

I also have this problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#22