Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
allorepair
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jansa Jose
allorepair
Commits
fe1882e3
Commit
fe1882e3
authored
5 years ago
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload pic changes
parent
e0080626
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
Webservice.php
application/controllers/Webservice.php
+33
-11
No files found.
application/controllers/Webservice.php
View file @
fe1882e3
...
...
@@ -86,6 +86,7 @@
echo
json_encode
(
$respArr
);
exit
;
}
if
(
$custResp
==
'1'
){
$postData
[
'user_type'
]
=
1
;
$custResp
=
$this
->
Webservice_model
->
checkCustomerLogin
(
$postData
);
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
echo
json_encode
(
$respArr
);
exit
;
...
...
@@ -235,22 +236,43 @@
//upload profilepic
public
function
upload_profilePic
(){
header
(
'Content-type: application/json'
);
$postData
=
$_POST
;
//$postData = $_POST;
$post
=
file_get_contents
(
"php://input"
);
$postData
=
json_decode
(
$post
,
true
);
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something went wrong.'
);
if
(
!
isset
(
$postData
[
'user_id'
])
||
empty
(
$postData
[
'user_id'
])){
$respArr
[
'message'
]
=
'User Id is Required'
;
echo
json_encode
(
$respArr
);
exit
;
}
if
(
isset
(
$_FILES
)
&&
!
empty
(
$_FILES
)
&&
isset
(
$_FILES
[
'user_profilepic'
])
&&
!
empty
(
$_FILES
[
'user_profilepic'
])){
$config
=
set_upload_service
(
"assets/uploads/customer"
);
$this
->
load
->
library
(
'upload'
);
$config
[
'file_name'
]
=
time
()
.
"_"
.
$_FILES
[
'user_profilepic'
][
'name'
];
$this
->
upload
->
initialize
(
$config
);
if
(
$this
->
upload
->
do_upload
(
'user_profilepic'
)){
$upload_data
=
$this
->
upload
->
data
();
$postData
[
'profile_photo'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
}
}
// if(isset($_FILES) && !empty($_FILES) && isset($_FILES['user_profilepic']) && !empty($_FILES['user_profilepic'])){
// $config = set_upload_service("assets/uploads/customer");
// $this->load->library('upload');
// $config['file_name'] = time()."_".$_FILES['user_profilepic']['name'];
// $this->upload->initialize($config);
// if($this->upload->do_upload('user_profilepic')){
// $upload_data = $this->upload->data();
// $postData['profile_photo'] = $config['upload_path']."/".$upload_data['file_name'];
// }
// }
$folderPath
=
"assets/uploads/customer/"
;
$image_parts
=
explode
(
";base64,"
,
$postData
[
'user_profilepic'
]);
$image_type_aux
=
explode
(
"image/"
,
$image_parts
[
0
]);
$image_type
=
$image_type_aux
[
1
];
$image_base64
=
base64_decode
(
$image_parts
[
1
]);
$file
=
$folderPath
.
uniqid
()
.
'.jpg'
;
file_put_contents
(
$file
,
$image_base64
);
$postData
[
'profile_photo'
]
=
$file
;
$custResp
=
$this
->
Webservice_model
->
upload_profilePic
(
$postData
);
if
(
$custResp
==
'1'
){
$respArr
=
array
(
'status'
=>
'success'
,
'message'
=>
'Profile Pic Updated Successfully'
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment