Anton Anton - 1 year ago 63
HTML Question

get the name of image when i upload it

When I upload image :

<h3 id="txt_i2">Img</h3><input type="file" accept="image/jpeg, image/jpg" name="picture" size="chars">

How to get the name of the uploaded img using php ? I don't mean "picture". For example if the img is called cow.jpg the get that "cow"

Answer Source

Anton, you can use the code below to get the image or any file name without extension.

$filename = pathinfo($_FILES['picture']['name'], PATHINFO_FILENAME);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download