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
Nov 01, 2019
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 @@
...
@@ -86,6 +86,7 @@
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
}
}
if
(
$custResp
==
'1'
){
if
(
$custResp
==
'1'
){
$postData
[
'user_type'
]
=
1
;
$custResp
=
$this
->
Webservice_model
->
checkCustomerLogin
(
$postData
);
$custResp
=
$this
->
Webservice_model
->
checkCustomerLogin
(
$postData
);
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
if
(
empty
(
$custResp
)
||
!
isset
(
$custResp
[
'status'
])
||
empty
(
$custResp
[
'status'
])){
echo
json_encode
(
$respArr
);
exit
;
echo
json_encode
(
$respArr
);
exit
;
...
@@ -235,22 +236,43 @@
...
@@ -235,22 +236,43 @@
//upload profilepic
//upload profilepic
public
function
upload_profilePic
(){
public
function
upload_profilePic
(){
header
(
'Content-type: application/json'
);
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.'
);
$respArr
=
array
(
'status'
=>
'error'
,
'message'
=>
'Something went wrong.'
);
if
(
!
isset
(
$postData
[
'user_id'
])
||
empty
(
$postData
[
'user_id'
])){
if
(
!
isset
(
$postData
[
'user_id'
])
||
empty
(
$postData
[
'user_id'
])){
$respArr
[
'message'
]
=
'User Id is Required'
;
$respArr
[
'message'
]
=
'User Id is Required'
;
echo
json_encode
(
$respArr
);
exit
;
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'
);
// if(isset($_FILES) && !empty($_FILES) && isset($_FILES['user_profilepic']) && !empty($_FILES['user_profilepic'])){
$config
[
'file_name'
]
=
time
()
.
"_"
.
$_FILES
[
'user_profilepic'
][
'name'
];
// $config = set_upload_service("assets/uploads/customer");
$this
->
upload
->
initialize
(
$config
);
// $this->load->library('upload');
if
(
$this
->
upload
->
do_upload
(
'user_profilepic'
)){
// $config['file_name'] = time()."_".$_FILES['user_profilepic']['name'];
$upload_data
=
$this
->
upload
->
data
();
// $this->upload->initialize($config);
$postData
[
'profile_photo'
]
=
$config
[
'upload_path'
]
.
"/"
.
$upload_data
[
'file_name'
];
// 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
);
$custResp
=
$this
->
Webservice_model
->
upload_profilePic
(
$postData
);
if
(
$custResp
==
'1'
){
if
(
$custResp
==
'1'
){
$respArr
=
array
(
'status'
=>
'success'
,
'message'
=>
'Profile Pic Updated Successfully'
);
$respArr
=
array
(
'status'
=>
'success'
,
'message'
=>
'Profile Pic Updated Successfully'
);
...
...
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