Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <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>
- public function updateUserProfile(Request $request)
- {
- $userimg = $request->file('user_profile_picture');
- echo json_encode(['status' => true, 'message' => $_FILES]);
- }
- {"status":true,"message":{"user_profile_picture":{"name":"","type":"","tmp_name":"","error":4,"size":0}}}
- $userimg = $request->file('user_profile_picture');
- echo json_encode(['status' => true, 'message' => $userimg]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement