Answers.Body: <p>Im my form, I also have a hidden field for the user photo:</p>
  
  <p><code>&lt;input type="hidden" name="photo" value="{{ currentUser.photo }}"&gt;</code>.</p>
  
  <p>I have <code>{% if currentUser.photo %}</code> instead of <code>{% if currentUser.photoUrl|length %}</code>.</p>
  
  <p>Also, <code>&lt;img src="{{ currentUser.getPhoto.getUrl() }}"&gt;</code> instead of <code>&lt;img src="{{ currentUser.photoUrl }}"&gt;</code>. This should display the current photo.</p>
  
  <p>EDIT:</p>
  
  <p>File input field name should be <code>photo</code>: <code>&lt;input type="file" id="photo" name="photo"&gt;</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-30T18:30:23.483Z
Answers.Text: Thanks Andrea, unfortunately even with adding a hidden value the form does not successfully change the photo.
Answers.UserDisplayName: JMKelley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-30T20:48:58.630Z
Answers.Text: Oops! Forgot the file input field. See updated answer.
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-30T17:35:52.673Z
Answers.LastActivityDate: 2018-11-30T20:28:09.377Z
Answers.LastEditDate: 2018-11-30T20:28:09.377Z
Answers.UserDisplayName: Andrea DeMers
Body: <p>I have this form, there's no errors getting thrown and the User photo field is not updating via this form.</p>
  
  <pre><code>      &lt;form method="post" accept-charset="UTF-8" enctype="multipart/form-data"&gt;
          {{ csrfInput() }}
          &lt;input type="hidden" name="action" value="users/save-user"&gt;
          &lt;input type="hidden" name="redirect" value="users/{{ currentUser.username }}"&gt;
          &lt;input type="hidden" name="userId" value="{{ currentUser.id }}"&gt;
  
          &lt;div class="form-group"&gt;
            {% if currentUser.photoUrl|length %}
                &lt;img src="{{ currentUser.photoUrl }}" class="img-fluid mb-2 border" /&gt;
            {% else %}
              &lt;img src="http://placehold.it/1024x468/f5f5f5/ccc.png" class="img-fluid mb-2" alt="{{ entry.title }}" /&gt;
            {% endif %}
            &lt;label&gt;Profile Picture&lt;/label&gt;
            &lt;input type="file" name="fields[photo]" class="form-control-file upload"&gt;
          &lt;/div&gt;
  
          &lt;input type="submit" value="Save Profile"&gt;
  
        &lt;/form&gt;
  </code></pre>
  
  <p>I'm unsure why it's not working, as it's fairly identical to some questions on SO.</p>
  
Tags: <templating>
Title: Updating User Photo from Front-End
ThreadText: # Updating User Photo from Front-End
  
  (Asked by: username_0 on 2018-11-30)
  
  I have this form, there's no errors getting thrown and the User photo field is not updating via this form.
  
  ```
        <form method="post" accept-charset="UTF-8" enctype="multipart/form-data">
          {{ csrfInput() }}
          <input type="hidden" name="action" value="users/save-user">
          <input type="hidden" name="redirect" value="users/{{ currentUser.username }}">
          <input type="hidden" name="userId" value="{{ currentUser.id }}">
  
          <div class="form-group">
            {% if currentUser.photoUrl|length %}
                <img src="{{ currentUser.photoUrl }}" class="img-fluid mb-2 border" />
            {% else %}
              <img src="http://placehold.it/1024x468/f5f5f5/ccc.png" class="img-fluid mb-2" alt="{{ entry.title }}" />
            {% endif %}
            <label>Profile Picture</label>
            <input type="file" name="fields[photo]" class="form-control-file upload">
          </div>
  
          <input type="submit" value="Save Profile">
  
        </form>
  
  ```
  
  I'm unsure why it's not working, as it's fairly identical to some questions on SO.
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-11-30. Score: 2 | Accepted answer
  
  Im my form, I also have a hidden field for the user photo:
  
  `<input type="hidden" name="photo" value="{{ currentUser.photo }}">`.
  
  I have `{% if currentUser.photo %}` instead of `{% if currentUser.photoUrl|length %}`.
  
  Also, `<img src="{{ currentUser.getPhoto.getUrl() }}">` instead of `<img src="{{ currentUser.photoUrl }}">`. This should display the current photo.
  
  EDIT:
  
  File input field name should be `photo`: `<input type="file" id="photo" name="photo">`
  
  > **Comments:**
  > **username_0**: Thanks username_1, unfortunately even with adding a hidden value the form does not successfully change the photo.  
  > **username_1**: Oops! Forgot the file input field. See updated answer.  
  
  ---
  
  