Solution 1 :

index.php

<form class="needs-validation" action="resultatcasier.php" method="post">
<h3>Informations sur le suspect</h3>
<hr>
    <p>Photo du suspect</p>
    <div class="custom-file">
        <input type="file" class="custom-file-input" id="customFileLang" lang="fr">
        <label class="custom-file-label" for="customFileLang">Choisir une image...</label>
    </div>
    <div class="form-row">
        <div class="form-group col-md-6">
        <label for="inputEmail4">Prénom</label>
        <input type="text" class="form-control" id="inputEmail4" required>
        </div>
        <div class="form-group col-md-6">
        <label for="inputPassword4">NOM (en majuscule)</label>
        <input type="text" class="form-control" id="inputPassword4" required>
        </div>
    </div>
    <p>Sexe:</p>
    <div class="custom-control custom-radio custom-control-inline">
        <input type="radio" id="customRadioInline1" name="customRadioInline1" class="custom-control-input">
        <label class="custom-control-label" for="customRadioInline1">Homme</label>
    </div>
    <div class="custom-control custom-radio custom-control-inline">
        <input type="radio" id="customRadioInline2" name="customRadioInline1" class="custom-control-input">
        <label class="custom-control-label" for="customRadioInline2">Femme</label>
    </div>
</form>

resultatcasier.php

$photo = $_POST["photo"];
$nom = $_POST["nom"];
$prenom = $_POST["prenom"];
$sexe = $_POST["sexe"];
print '$nom';
print '$prenom';
print '$sexe';

Problem :

My request today is to give the possibility to the users of my site to upload an image and to modify this image to add elements in PHP.

index.php

...
    <div class="custom-file">
        <input type="file" class="custom-file-input" id="photo" name="photo" lang="fr">
        <label class="custom-file-label" for="photo">Choose an image...</label>
    </div>
...

result.php

$photo = $_POST["photo"];

I would like, with the image file sent by the users, to do this kind of thing (i.e. “paste” this upload image on a source image already known by the server (written directly in the code of the site)) : https://openclassrooms.com/fr/courses/918836-concevez-votre-site-web-avec-php-et-mysql/916429-creez-des-images-en-php

Any ideas ?

For the moment, when I choose an image in my files and I click on “open”, nothing is displayed in the file selection bar, as if nothing had happened… I use Bootstrap…

Thanks in advance 😉

Comments

Comment posted by Professor Abronsius

you need to use

Comment posted by Quentin M.

My goal is quite simple, take the image sent by the user, “paste” it in the right place on a source image and output to the user the modified image (source image + image sent by the user).

Comment posted by Professor Abronsius

OK – please add all the code that you have written so far to solve this problem

Comment posted by GetSet

Many things are simple to say that aren’t simple to code.

Comment posted by Quentin M.

I don’t get any error messages, I just don’t know how to make a user upload an image, and call that image later in my PHP code.

Comment posted by GetSet

So what you basically want to happen is for someone to finish your program?

Comment posted by Quentin M.

No, I’m asking if anyone can unblock me or if anyone knows a doc about it.

Comment posted by GetSet

There are already many solved threads in SO for your issue of uploading an image via HTML and PHP. As to the rest of your design goals, you should take a stab at it then post back here if you run into problems.

By