dim image(1000) as byte
thuimage.save(image,s)
s为thuimage的大小
好象这样可以。

解决方案 »

  1.   

    HttpPostedFile SendImage=UpFileControl.PostedFile;//选择的是图片文件
    imageSize=SendImage.ContentLength;////取得图片
    imageBody=new Byte[imageSize];
    Stream StreamObject=SendImage.InputStream;//建立数据流对象
    StreamObject.Read(imageBody,0,imageSize);///把图像数据放到mMarkBody中,其中0代表数据指针的初始位置,intFileLength代表要读取的流的长度
      

  2.   

    http://www.aspxboy.com/Files/71/66/200392971219.htm
      

  3.   

    byte[] imagedata=null;
    BinaryReader br=new BinaryReader(....);
    int len=(int)br.basestream.length ;
    imagedata=br.readbytes(len);
      

  4.   

    string postFileName=postFile.PostedFile.FileName;
    string fileExt=Path.GetExtension(postFileName);
    string fileName=Path.GetFileName(postFileName);
    if (fileName.Trim()=="")
    {
    Page.RegisterStartupScript("","<script>alert('"+"上传文件不能为空"+"');</script>");
    }
    else
    {
    if(postFile.PostedFile.ContentLength>2024000)
    {
    Page.RegisterStartupScript("","<script>alert('"+"上传文件过大"+"');</script>");
    }
    else
    {
    string newFileName=DateTime.Now.ToString("yyyyMMddhhmmssffffff");
    fileNameExt=newFileName+fileExt;
    string pathFile=Server.MapPath("\\snack\\"+fileNameExt);
    postFile.PostedFile.SaveAs(pathFile);
    System.Drawing.Image image=System.Drawing.Image.FromFile(Server.MapPath("\\snack\\"+fileNameExt));
    System.Drawing.Image thuimage=null;
    if (image.Width>150 | image.Height>120)
    {
    thuimage=image.GetThumbnailImage(150,120,null,new IntPtr());
    }
    else
    {
    thuimage=image;
    }
    我怎么把thuimage这个对象为变成byte[],或者直接办法存到数据库中image字段去?