vendredi 29 mars 2019

Ember.js and image uploading

I'm having trouble with uploading images in Ember.js

I have a form to create a user :

<div class="container">
<form onsubmit= enctype="multipart/form-data">
  <div class="form-group">
    <label for="firstName">First name: </label>
    
  </div>
  <div class="form-group">
    <label for="lastName">Last name: </label>
    
  </div>
  <div class="form-group">
    <label for="age">Age: </label>
    
  </div>
  <div class="form-group">
    <label for="job">Job: </label> 
    
  </div>
  <div class="form-group">
    <label for="image">Picture: </label> 
    
  </div>
  <button type="submit" class="btn btn-info">Create</button>
</form>

I know I should encode images in base64 but I have no idea how to do that since I've never done it before.

And in the view, this is how I'm trying to get the image (I know this is not what I should do but I don't know how to do it) :

<div class="container">

<h1> </h1>
<p>Age:  years old</p>
<p>Job: </p>
<img src="" alt="img" id="image">

Any ideas, suggestions, help please ?




Aucun commentaire:

Enregistrer un commentaire