Skip to content
Advertisement

php returns errors when uploading and image to server

I hope all is well. i am in the process of learning php and sql and i am trying to make a piece of code work where i can upload an image and itll save to a folder…i have found a piece of code that accepts base64 encoding, which would be perfect but it doesnt seem to work currently… so i have been testing it on postman, using the body raw option i have been inputting {"upfile":"whatever the base64 encode is"} when doing that it returns a

JavaScript

when i try the other option on postman which is the form data where i specify “upfile” as the key and upload an image, it gives this error

JavaScript

my question is, how can i make it such that this code works, and which method of testing would be better?

JavaScript

?>

Advertisement

Answer

In Your you just have to make a pic folder on current directory and use “$target_dir”

JavaScript

Example of Uploading File in Php :

JavaScript

php code :

JavaScript

base 64 code for image in db :

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement