只应通过引用传递变量。// Other variables$MAX_FILENAME_LENGTH = 260;$file_name = $_FILES[$upload_name]['name'];//echo "testing-".$file_name."<br>";//$file_name = strtolower($file_name);$file_extension = end(explode('.', $file_name)); //ERROR ON THIS LINE$uploadErrors = array(
0=>'There is no error, the file uploaded with success',
1=>'The uploaded file exceeds the upload max filesize allowed.',
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3=>'The uploaded file was only partially uploaded',
4=>'No file was uploaded',
6=>'Missing a temporary folder');有什么想法吗?两天后仍然卡住。
3 回答
![?](http://img1.sycdn.imooc.com/5458662500019a7c02200220-100-100.jpg)
莫回无
TA贡献1865条经验 获得超7个赞
explode
end
:
$tmp = explode('.', $file_name);$file_extension = end($tmp);
end
explode('.', $file_name)
![?](http://img1.sycdn.imooc.com/54584cde0001d19202200220-100-100.jpg)
眼眸繁星
TA贡献1873条经验 获得超9个赞
$fileName = 'long.file.name.jpg';$tmp = explode('.', $fileName);$fileExtension = end($tmp);echo $fileExtension;// jpg
![?](http://img1.sycdn.imooc.com/5458689e000115c602200220-100-100.jpg)
潇湘沐
TA贡献1816条经验 获得超6个赞
$file_extension = pathinfo($file_name, PATHINFO_EXTENSION);
- 3 回答
- 0 关注
- 391 浏览
添加回答
举报
0/150
提交
取消