如何将图片与AngularJS中的其他数据一起上传

我是AngularJS的新手,从http://www.angularcode.com/user-authentication-using-angularjs-php-mysql/ tutorial学习AngularJS中的登录/注册功能。 在本教程中,注册时没有图片上传功能,我想上传图片以及其他信息。 我将如何做到这一点!?

提前致谢


基本上,你有两个选择:

  • 将图像文件与其他数据一起发送。为此,请求内容类型应该是multipart / form-data。
    看看:http://shazwazza.com/post/Uploading-files-and-JSON-data-in-the-same-request-with-Angular-JS

  • 将图像上载到服务器,接收其ID,然后将ID与附加数据一起发送到服务器。
    查看:将文件和关联数据发布到RESTful WebService(最好是JSON)

  • 链接地址: http://www.djcxy.com/p/48649.html

    上一篇: How to upload image along with other data in AngularJS

    下一篇: type does dropbox (file put) api uses? and How to mimic it?