how to upload base64 image in codeigniter using postman

Опубликовано: 04 Октябрь 2024
на канале: Allround Zone
6,742
25

hi guys in this video we learn how to upload base64 image in codeigniter using postman.
code
//generate unique name
$date = new DateTime();
$startdata = $date-format('YmdHis');
$newName = str_replace('/', '', $startdata) . $userid;

// get base64 image form request
// you just need to replace the content variable with your variable send from the postman
//replace bracket

$image =$this-*input-*post("content");

$image_name= $newName;

//convert base64 to image and save in specific location/dir
file_put_contents(
"application/assets/uploads/".$image_name.".jpg",
base64_decode(
str_replace('data:image/jpeg;base64,', '', $image)
)
);


if you have any issue comment below

share support subscribe
#allroundzone
#allround

Steemit https://steemit.com/@ahmadkhan

subscribe    / @allroundzone  

twitter   / all___round  

  / khanallround  

facebook   / allroundkhan  

facebook page   / allroundzzone  

Google plus https://plus.google.com/u/0/102707003...