Hi all,

Im wanting to have an "upload picture" button, that on clicking will upload the picture into a directory, but then capture only the filename of the picture to be stored in the database.

This is for creating a catalogue entry.

Im fine with the form information and disabling parts after upload, so i guess i only need to know how to capture a name of a file.

Any direction would be appreciated

regards

paul

Recommended Answers

All 2 Replies

When using a form to upload files, (input type="file") you can get the name of the file this way:

$name = $_FILES['upload']['name'];

Assuming that your form looks like this:

<form method="post" action="upload.php">
<input type="file" name="upload" value="" maxlength="200" size="40">
<input type="submit" value="submit">
</form>

Thanks all. Worked a treat

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.