I am trying to upload an image to server using PHP and the save inside a dir, and then returning the image url.
HTML:
Here's a simple one.
HTML form to upload image
Your PHP file that does the Upload
";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
echo "";
echo '';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "
";
?>
Source