Allow a visitor to my website to upload an image

Hi There, firstly apologies. I am very new to HTML still on the learning road.

I am looking into something for my Pool League. What we want to do is allow visitors to upload images of their result sheets. I have found a couple of bit of HTML code around uploading files but I can't get them to work.

Sorry but is someone able to throw together an idiots guide on how to do it? Or point me to somewhere that offers this.
We use 1and1 for our website.

Look forward to hearing from someone soon.
Simon GillhamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
You need to use input type = FILE like below -

<input type="file" name="myfile" size="100">
0
Chris StanyonWebDevCommented:
You won't be able to do this with just HTML. The HTML part allows a user to select a file and upload it to the server, but you will also need a server-side script (PHP) to actually handle the file once it hits the server.

Here's a starting guide from the W3 site - https://www.w3schools.com/php/php_file_upload.asp

Have a read through it and come back with any questions
0
M. AhsanCommented:
Page to upload immage
<!DOCTYPE html>
<html>
<body>

<form action="upload.php" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form>

</body>
</html>
// Server side Page code to store image in a directory

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
?>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pawan KumarDatabase ExpertCommented:
Question abandoned
Provided solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.