当我上传图片时获取图片的名称 [英] get the name of image when i upload it

查看:198
本文介绍了当我上传图片时获取图片的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传图片时:

 < h3 id =txt_i2> Img< / h3>< input type =fileaccept =image / jpeg,image / jpgname =picturesize =chars> 

如何使用php获取上传的img的名称?我不是说图片。例如,如果img被称为cow.jpg,那么得到cow


$ b

  $ filename = pathinfo($ _ FILES ['picture'] ['name' ],PATHINFO_FILENAME); 


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"

解决方案

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

$filename = pathinfo($_FILES['picture']['name'], PATHINFO_FILENAME);

这篇关于当我上传图片时获取图片的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆