php - error 500 image base64 -


good day all, it's first time post here.

i want upload image in domain using image encoded base64, image uploaded server, i'm still getting server error 500, memory_limit @ php.ini file 128m`
i'm using xampp server

    <?php  header('content-type : bitmap; charset=utf-8');  $encoded_string = $_post['string_encoded']; //encoded string  $imagename = 'image.png';  $decoded_string = base64_decode($encoded_string);  $path = 'imageses/'.$imagename;  $file = fopen($path, 'wb');  fwrite($file, $decoded_string); fclose($file);  ?>` 

let's suppose image.png has size of 2mb. in case, decoding base64 write 64 * 2 mb memory, 128 mb. cause of issue. fix it, increase memory_limit in php.ini. possible problem can script loaded several times, doing same large decoding in parallel manner. if fails, can still achieve success, not decoding whole file, 1 smaller packet @ time , forgetting packet when calculated possible.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -