各位.我想做一个和邮箱大致的功能.
把附件和文本内容一起提交到服务器保存到数据库.或者把附件上传到服务器的一个目录下.然后把文本内容,和上传附近的目录保存写到数据库里.
请问,哪位能不能大概给点代码.非常感谢

解决方案 »

  1.   

    数据库好整文件上传上传要么用FTP,要么用Remoting 自己写服务器
      

  2.   

    1. <form action="?action=save" method="post" enctype="multipart/form-data" >
       form值的类型应为method="post" enctype="multipart/form-data"
    2. 找一个 无组件上传类 
    3.处理提交的数据set rs=server.CreateObject("adodb.recordset")
    filepath="图片存放路径"'创建一个  无组件上传实例
    set upload=new upload_file'读取表单中的其它字段数据
    picPath=trim(upload.form("picPath"))
    proName=trim(upload.form("proName"))'打开要存放数据的表rs.open "select * from table",conn,1,3
    rs.addnew
    '将图片写入机器
    for each formName in upload.File
    set file=upload.File(formName) 
        fileExt=lcase(file.FileExt) '得到的文件扩展名不含有.
    spPic=""

        if file.filesize>100 then
       
    if fileext<>"gif" and fileext<>"jpg"  then
    response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
    response.end
        end if
        if file.filesize>(1000*1024) then
    response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 1000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
    response.end
    end if
            randomize
        ranNum=int(90000*rnd)+10000
        spPic=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
        filename=filepath&spPic
         if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
              file.SaveToFile Server.mappath(FileName)  
        end if
      end if
        set file=nothing
    next
    set upload=nothing'往表中添加其它字段的值
    rs("proName")=proName
    rs("proSize")=proSize
    '添加图片的文件名rs.update
    rs.close
    'ok 添加成功
      

  3.   

    楼上的.先感谢啊
    我是要用C#和ASP.NET,兄弟.能不能再给点全面的.非常感谢.分不够再加啊.