Uploading and Retrieving an Image with Angular

0

Let's say I have a user registration form where I want to save a photo of it. I send this data by POST to the server (Java) where I make the inclusion in the database.

What better way (practice) to send this photo along with the other data to my server? Save this image to a directory or to a BLOB field in the database? Do I have to send the image as a Array of bytes ? And how do I retrieve this image when I make an appointment at my bank?

If possible I would like some examples or explanations.

    
asked by anonymous 25.09.2015 / 20:12

1 answer

1

If you are using AngularJS I will indicate a javascript plugin for it.

This is FlowJS (ng-flow) . An example:

<div flow-init="{target: '/upload'}"
     flow-files-submitted="$flow.upload()"
     flow-file-success="$file.msg = $message">

  <input type="file" flow-btn/>
      Input OR Other element as upload button
  <span class="btn" flow-btn>Upload File</span>

  <table>
    <tr ng-repeat="file in $flow.files">
        <td>{{$index+1}}</td>
        <td>{{file.name}}</td>
        <td>{{file.msg}}</td>
    </tr>
  </table>
</div>
    
25.09.2015 / 21:13