<form method=post enctype="multipart/form-data" action=“upload.php">
<input type=file name="thefile">
<input type="submit" value="upload">
</form>Upload.php
<?
echo "<br>".$thefile;
echo "<br>".$thefile_name;
echo "<br>".$thefile_size;
echo "<br>".$thefile_type;if($thefile_type="image/jpeg") //or gif etc.
{
if(is_uploaded_file($thefile))
{ $file="upload//".$thefile_name;
move_uploaded_file($thefile,$file);}
}
?>
<input type=file name="thefile">
<input type="submit" value="upload">
</form>Upload.php
<?
echo "<br>".$thefile;
echo "<br>".$thefile_name;
echo "<br>".$thefile_size;
echo "<br>".$thefile_type;if($thefile_type="image/jpeg") //or gif etc.
{
if(is_uploaded_file($thefile))
{ $file="upload//".$thefile_name;
move_uploaded_file($thefile,$file);}
}
?>
$result=mysql_query($sql,$conn);
$row=mysql_fetch_array($result);
if ($row["id"]==""){
$id=1;}
else{
$id=$row["id"]+1;}
$rq=date("Y-m-d H:i:s");
$filepath="../imgs/";
$sid=$sid+1;
$id="cgal".$sid."_".$id;
$nid=$nid.",".$id;
if(!file_exists("$filepath"))mkdir($filepath,0700);
copy($file,$filepath.$id.".gif");?>
<? }}else{
$sid=0;
$nid="";}?>
出错:说是在copy一行,怎么回事啊?
Warning: Unable to create '../imgs/cgal1_37.gif': Permission denied
Rs.open sql,imgConn,1,3 ‘追加数据到数据库 Rs.AddNew Rs(“img”).AppendChunk myData Rs.Update ‘关闭和释放对象 Rs.close ImgConn.close Set Rs=Nothing Set ImgConn=Nothing %〉 2) ShowImg.asp文件代码: 〈% Response.Expires = 0 Response.buffer=True Response.clear ‘创建对象实例 Set imgConn=Server.CreateObject(“ADODB.Connection”) StrConn=”Driver={SQL Server};Server=ServerName;”& _“Uid=xxxx;Pwd=xxxx;DataBase=DataBaseName” imgConn.open strConn Set Rs= Server.CreateObject(“ADODB.RecordSet”) Sql=”Select img From img Where id=1” 这里的id可以使用Request(“id”)获得 Rs.open sql,imgConn,1,1 Response.ContentType=”image/*” Response.BinaryWrite Rs.(“img”).GetChunk(7500000) ‘关闭和释放对象 Rs.close ImgConn.close Set Rs=Nothing Set ImgConn=Nothing %〉