<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body><?php $image = $_FILES['mypicture'];$imageName = $image['name'];$tmp_name = $image['tmp_name'];$error = $image['error'];$dirName = $_POST['dirName'];print_r($image);if(is_uploaded_file($tmp_name)){ if(is_dir($dirName)) { chdir($dirName); $path = $dirName.'/'.$imageName; move_uploaded_file($tmp_name,$path); echo "<img src='".$path."'>"; } else { mkdir($dirName,0777); chdir($dirName); $path = $dirName.'/'.$imageName; move_uploaded_file($tmp_name,$path); echo "<img src='".$path."'>"; }}?><form action="" method="post" enctype="multipart/form-data"><input type="file" name="mypicture" accept="image/gif , image/jpeg , image/jpg , image/png" />上传到文件夹名称:<input type="text" name="dirName" /><input type="submit" name="bnt" value="上传" /></form></body></html>
目前暂无任何回答
- 0 回答
- 1 关注
- 1597 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消