Backbone. Form with file upload, how to handle?

2019-02-01 01:14发布

I want to organize the workflow only through the REST API. I have a form that allows to upload image (enctype="multipart/form-data"). How do I handle this form via backbone? Help me please, how I can to serialize it into JSON with a file field.

Thanks. Vitaliy

标签: backbone.js
7条回答
女痞
2楼-- · 2019-02-01 01:45

IMHO, you cannot serialize a file into JSON. If you need to send some data along with the file you can send them as query params with POST method.

www.example.com/upload?param1=value1&param2=value2
查看更多
登录 后发表回答