Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name="user_profile_form" id="user_profile_form" method="post" enctype="multipart/form-data">
- <input type="hidden" name="authorization" value="{{$authorization}}" id="authtoken"/>
- <input type="hidden" name="device_type" value="{{$device_type}}"/>
- <div class="pa-padding">
- <div class="pa-avatar">
- <img src="{{url('userprofile')}}/{{$user->profile_picture}}" alt="" width="100"
- height="100"
- id="user_profile_img">
- </div>
- <div class="pa-name">{{$user->name}}</div>
- <div class="pa-text">Web Developer · Designer · Team Lead</div>
- <br>
- <label for="f_upload" type="button" class="btn btn-primary m-r-10">
- <i class="zmdi zmdi-upload"></i> Upload profile Picture</label>
- <input id="f_upload" type="file" style="display: none" name="user_profile_picture"
- accept="image/*"/>
- <button type="button" id="save_user_profile">Save</button>
- </div>
- </form>
- <script type="text/javascript">
- $("#save_user_profile").click(function (event) {
- event.preventDefault();
- var authorizationToken = $("#authtoken").val();
- var form = document.forms.namedItem("user_profile_form"); // high importance!, here you need change "yourformname" with
- var formData = new FormData(form);
- $.ajax({
- headers: {
- 'Authorization': authorizationToken,
- 'device_type': 'android'
- },
- async: true,
- type: 'post',
- contentType: false,
- cache: false,
- url: '{{ action('MobileUserProfileController@updateUserProfile') }}',
- data: formData,
- processData: false,
- success: function (data) {
- var result = JSON.parse(data);
- if (result.status) {
- alert(result.message);
- } else {
- alert(result.message);
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- alert(errorThrown);
- }
- });
- });
- Android.pageParams("Profile", "", "", false, "", "", "");
- </script>
- $userimg = $request->file('user_profile_picture');
- echo json_encode(['status' => true, 'message' => $_FILES]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement