选择显示字体大小

用 perl 实现文件上传


示例的 html 文件如下:
<html>
<body>
<form method=&quot;post&quot; action=&quot;psupload.cgi&quot; enctype=&quot;multipart/form-data&quot;>
file 1:
<input type=&quot;file&quot; name=&quot;file1&quot;>
<br>
file 2:
<input type=&quot;file&quot; name=&quot;file2&quot;>
<br>
<input type=&quot;submit&quot; value=&quot;upload!&quot;>
</form>
</body>
</html>

后台的 perl 程序如下:

#!/usr/bin/perl
#######################################
## perl services upload helper v1.0 ##
## http://www.perlservices.com ##
## perlservices@perlservices.com ##
## ###########################################
## you should carefully read all of the following terms and conditions ##
## before using this program. your use of this software indicates your ##
## acceptance of this license agreement and warranty. ##
## this program is being distributed as freeware. it may be used ##
## free of charge, but not modified below the line specified. this copyright ##
## must remain intact. ##
## ##
## by using this program you agree to indemnify perl services from any ##
## liability. ##
## ##
## selling the code for this program without prior written consent is ##
## expressly forbidden. obtain permission before redistributing this ##
## program over the inte.net or in any other medium. in all cases the ##
## copyright must remain intact. ##
## ##
## there are security hazards involved with this script. read the readme file##
## before using the script. ##
################################################################################

##
## start setting up options here:

## your path to where you want your files uploaded.
## note: no trailing slash
&#36;basedir = &quot;/home/path/to/directory&quot;;

## do you wish to allow all file types? yes/no (no capital letters)
&#36;allowall = &quot;yes&quot;;

## if the above = &quot;no&quot;; then which is the only extention to allow?
## remember to have the last 4 characters i.e. .ext
&#36;theext = &quot;.gif&quot;;

## the page you wish it to forward to when done:
## i.e. http://www.mydomainname.com/thankyou.html
&#36;donepage = &quot;http://www.perlservices.com/&quot;;

################################################
################################################
## do not edit or copy below this line ##
################################################
################################################

 

 

 

use cgi;
&#36;onnum = 1;

while (&#36;onnum != 11) {
my &#36;req = new cgi;
my &#36;file = &#36;req->param(&quot;file&#36;onnum&quot;);
if (&#36;file ne &quot;&quot;) {
my &#36;filename = &#36;file;
&#36;filename =~ s!^.*(\\\/)!!;
&#36;newmain = &#36;filename;
if (&#36;allowall ne &quot;yes&quot;) {
if (lc(substr(&#36;newmain,length(&#36;newmain) - 4,4)) ne &#36;theext){
&#36;filenotgood = &quot;yes&quot;;
}
}
if (&#36;filenotgood ne &quot;yes&quot;) {
open (outfile, &quot;>&#36;basedir/&#36;filename&quot;);
print &quot;&#36;basedir/&#36;filename<br>&quot;;
while (my &#36;bytesread = read(&#36;file, my &#36;buffer, 1024)) {
print outfile &#36;buffer;
}
close (outfile);
}
}
&#36;onnum++;
}

print &quot;content-type: text/html\n&quot;;
print &quot;location:&#36;donepage\n\n&quot;;

  


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons