1234567891011121314151617 |
- <%= bootstrap_form_for(@user) do |f| %>
- <%= render 'shared/error_messages', object: f.object %>
- <%= image_tag @user.picture.url if @user.picture? %>
- <%= f.file_field :picture, accept: 'image/jpeg,image/gif,image/png' %>
- <%= f.submit "Save picture", class: "btn btn-primary" %>
- <% end %>
- <script type="text/javascript">
- $('#user_picture').bind('change', function() {
- var size_in_megabytes = this.files[0].size/1024/1024;
- if (size_in_megabytes > 5) {
- alert('Maximum file size is 5MB. Please choose a smaller file.');
- }
- });
- </script>
|