• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    用 perl 實現文件上傳

    發布: 2007-7-04 20:04 | 作者: admin | 來源:  網友評論 | 查看: 14次 | 進入軟件測試論壇討論

    領測軟件測試網 示例的 HTML 文件如下:
    <html>
    <body>
    <form method="POST" action="psupload.cgi" ENCTYPE="multipart/form-data">
    File 1:
    <input type="file" name="FILE1">
    <br>
    File 2:
    <input type="file" name="FILE2">
    <br>
    <input type="submit" value="Upload!">
    </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 Internet 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
    $basedir = "/home/path/to/directory";

    ## Do you wish to allow all file types? yes/no (no capital letters)
    $allowall = "yes";

    ## If the above = "no"; then which is the only extention to allow?
    ## Remember to have the LAST 4 characters i.e. .ext
    $theext = ".gif";

    ## The page you wish it to forward to when done:
    ## I.E. http://www.mydomainname.com/thankyou.html
    $donepage = "http://www.perlservices.com/";

    ################################################
    ################################################
    ## DO NOT EDIT OR COPY BELOW THIS LINE ##
    ################################################
    ################################################

     

     

     

    use CGI;
    $onnum = 1;

    while ($onnum != 11) {
    my $req = new CGI;
    my $file = $req->param("FILE$onnum");
    if ($file ne "") {
    my $fileName = $file;
    $fileName =~ s!^.*(\\|\/)!!;
    $newmain = $fileName;
    if ($allowall ne "yes") {
    if (lc(substr($newmain,length($newmain) - 4,4)) ne $theext){
    $filenotgood = "yes";
    }
    }
    if ($filenotgood ne "yes") {
    open (OUTFILE, ">$basedir/$fileName");
    print "$basedir/$fileName<br>";
    while (my $bytesread = read($file, my $buffer, 1024)) {
    print OUTFILE $buffer;
    }
    close (OUTFILE);
    }
    }
    $onnum++;
    }

    print "Content-type: text/html\n";
    print "Location:$donepage\n\n";

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備2023014753號-2
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>