<!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> <style> body{margin:0} form{ margin:0;padding:0; } input{ float:left;height:22px;border:1px solid #DBE6E3;background:#FFF; width:250px; } .btn1{ width: 50px; border: none; background: url("images/btn1.gif") 0 0 no-repeat; color: #0099CC; cursor: pointer; } input[type="file"] { color:#CCC; font-size:12px; } </style> <script> function chkuploadfile(){ if(document.getElementById("filedata").value == ''){ alert('请选择需要上传的文件'); return false; } return true; } </script> </head> <body> <form method="post" name="form1" action="imgUploadFile.php?id=<?php echo $_GET['id'] ?? ''; ?>&act=s" enctype="multipart/form-data" onsubmit="return chkuploadfile()"> <input type="file" name="filedata" id="filedata" /><input type="submit" value="上传" class="btn1" /> </form> </body> </html>