Skip to content
Advertisement

PHP image upload function, save in a dir and then return save image url

I am trying to upload an image to server using PHP and the save inside a dir, and then returning the image url.

HTML:

JavaScript

PHP

JavaScript

I have not much idea of PHP, I got a code from SO, but it did not do anything. Kindly help me to fix this code, or give a simple code to perform an upload:

JavaScript

Advertisement

Answer

Here’s a simple one.

HTML form to upload image

JavaScript

Your PHP file that does the Upload

JavaScript

Source

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