Answer the question
In order to leave comments, you need to log in
How to save image to server from base64?
Hello. I'm trying to save a base64 image to disk. Not saved. What is the reason how to solve?
Here is the code:
$imagee = base64_decode($Product->Изображение->Данные);
$FPName = $products[$i]['ID'].'.'.$Product->Изображение->Расширение;
$FPPath = '/img/'.$FPName;
file_put_contents($FPPath, $imagee, LOCK_EX);
Answer the question
In order to leave comments, you need to log in
You have an absolute path.
Either write full from the root of the server, or relative$FPPath = './img/'.$FPName;
file_put_contents($FPPath, $imagee, LOCK_EX);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question