像写邮件那样,点添加附件,打开文件对话框,选择文件后,把文件名称显示出来就行了;还可以继续添加附件。 我现在用的<input type="file" name="file">,效果不是很好啊。高手指点一下。 

解决方案 »

  1.   

    php 做个简单点的文件上传功能在看看你写的内容。
    晕,你这叫简单啊。网上插件多的很。
      

  2.   

    artDialog4[一个基于javascript编写的对话框组件,它拥有精致的界面与友好的接口]
    http://www.planeart.cn/demo/artDialog/_doc/new.html
    PHP文件上传实例[SWFObject Demo]
    http://demo.swfupload.org/v220/swfobjectdemo/index.php
    下载地址:
    http://code.google.com/p/swfupload/downloads/detail?name=SWFUpload_v250_beta_3_samples.zip&can=2&q=
      

  3.   

    <!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=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
      <label for="fileField"></label>
      <input type="file" name="file" id="file" />
      <input type="submit" name="button" id="button" value="提交" />
    </form>
    <?php
    echo $_FILES["file"]["name"]."<br>";
    echo $_FILES["file"]["tmp_name"]."<br>";
    echo $_FILES["file"]["size"]."<br>";
    echo $_FILES["file"]["type"]."<br>";
    $path=rand(0000,9999);
    if(!file_exists(images)){            /*is_dir()*/
    mkdir(images);
    }else{
    $up=move_uploaded_file($_FILES["file"]["tmp_name"],"images/".$path.$_FILES["file"]["name"]);
    }
    ?>
    </body>
    </html>
    我也是初学者,有兴趣的话一起学习!
      

  4.   

    我正在学session,顺便给你个例子吧:
    <?php session_start("filename","yzm");?>
    <!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=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="form1" id="form1">
      <label for="fileField"></label>
      <input type="file" name="file" id="file" />
      <input type="submit" name="button" id="button" value="提交" />
    </form>
    <p>
      <?php
    echo $_FILES["file"]["name"]."<br>";
    echo $_FILES["file"]["tmp_name"]."<br>";
    echo $_FILES["file"]["size"]."<br>";
    echo $_FILES["file"]["type"]."<br>";
    $path=date(Ymd);
    $_SESSION["filename"]=$path.$_FILES["file"]["name"];
    if(!file_exists(images)){            /*is_dir()*/
    mkdir(images);
    }else{
    $up1=move_uploaded_file($_FILES["file"]["tmp_name"],"images/".$path.$_FILES["file"]["name"]);
    if($up1){
    echo '<script type="text/javascript">alert("文件上传成功!")</script>';
    }else{
    echo '<script type="text/javascript">alert("文件上传失败!")</script>';
    }
    }
    ?>
    </p>
    <p>用户头像是:<img src="<?php echo "images/".$_SESSION["filename"];?>" /></img></p>
    <?php echo $_SESSION["filename"];?>
    </body>
    </html>