#OS is Win2000 server $picdir="d:\\inetpub\\wwwroot\\m_html\\news_pics\\"; use CGI; $delfer=new CGI; $file=$delfer->param('file'); $file=~/[\/|\\]?(\w+\.\w+)$/; $filename=$1; &print_error("jpg or gif please") if(($filename!~/\w+\.jpg/)&&($filena +me!~/\w+\.gif/)); &print_error("filename less than 20") if(length($filename)>20); &print_error("has been in existence") if(-e ("$picdir$filename")); open(IMAGE,">$picdir$filename") || &print_error("fail to open file"); binmode IMAGE; binmode $file; while($bytes=read($file,$buffer,1024) ) { $sum+=$bytes; if ($sum> 102400) { close IMAGE; unlink($picdir.$filename); &print_error("less than 100k"); } print IMAGE $buffer; } close IMAGE; unless($sum) { unlink($picdir.$filename); &print_error("can not be zero"); } sub print_error{......}
In reply to RE: RE: upload error
by iic
in thread upload error
by iic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |