-3

I am newbie in AngularJS and learning login/registring functionality in AngularJS from http://www.angularcode.com/user-authentication-using-angularjs-php-mysql/ tutorial. In this tutorial there is no image upload functionality in signup, and I want to upload image along with other information. How will I do it !?

Thanks in advance

Alpesh Trivedi
  • 944
  • 2
  • 13
  • 33

1 Answers1

0

Basically, you have two choices :

  1. Send the image file together with additional data.For this to work the request content type should be multipart/form-data.
    Look at : http://shazwazza.com/post/Uploading-files-and-JSON-data-in-the-same-request-with-Angular-JS

  2. Upload the image to the server ,receive its id and then send the id to the server together with the additional data.
    Look at : Posting a File and Associated Data to a RESTful WebService preferably as JSON

Community
  • 1
  • 1
  • thanks for the links!! But fix the first one (shazwazza) because both are pointing to the same stackoverflow link. – Rodrigo Mar 10 '16 at 19:57