$image = base64_decode($this->input->post("image_base64_string"));
// decoding base64 string value
$image_name = md5(uniqid(rand(), true));// image name generating with random number with 32 characters
$filename = $image_name . '.' . 'png';
//rename file name with random number
$path = set_realpath('product/image/');
//image uploading folder path
file_put_contents($path . $filename, $image);
// image is bind and upload to respective folder
THNAKS A LOT ! U Just saved my project
ReplyDelete$path = set_realpath('product/image/'); not working
ReplyDeletethen i tried $path = 'product/image/'; now its working
Message: file_put_contents(http://localhost/ssw/upload/profile/1/577dd0c83561dcff5f23d48121786629.png): failed to open stream: HTTP wrapper does not support writeable connections
ReplyDeleteit contains http OR https so it's not gonna work
Deletenice
ReplyDeletefile_put_contents(http://demo.switch2webpro.com/programming/my_circo/upload/profile/e2c6264f9b1e0a7adbb09542b3747f3e.png): failed to open stream: HTTP wrapper does not support writeable connections
ReplyDelete$image = base64_decode(explode( ',', $your_full_base64_code )[1]);
ReplyDelete