http://www.ppsql.com/software/p227/A22727898.shtml

解决方案 »

  1.   

    http://www.sqlsky.com/dotNet/070721/539/
      

  2.   

    往哪传?
    如果是数据库
    获取图片路径path
    FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read);
    byte [] b=new byte[fs.Length];
    fs.Read(b, 0, fs.Length);
    往数据库存,直接把字节数组Insert进去就行
    如果要建立Image,可以先讲字节数组放入内存流中,再生成Image
    MemoryStream ms = new MemoryStream(b);
    Image image = Image.FromStream(ms);
      

  3.   

    用 <asp:upfile 组件啊,很简单
      

  4.   

    我有代码,但不在这台机上。下次有机会再送上去。
    思路把图片上传比较简单,用image控件直接可以上传。显示就要把读出来二进制转化成图片
      

  5.   

    请问ycg_893 : 远程下载、上传文件如何分块啊?非常谢谢!!!
      

  6.   

    http://www.80diy.com/home/20031129/03/2507828.html
      

  7.   

    www.jiujiange.com 我们是面向企业员工福利的在线平台,目前需要对系统进行改版,部分版块程序希望外包给有能力的工程师来完成,希望该工程师对.net,c#精通,对mvc架构熟悉,如能进一步对div css切图有所掌握,合作内容更多,如你感兴趣,请尽快联系我们,13524864423,[email protected] mr lay
      

  8.   

    在数据库中添加一个image列 我的只有一列 所以是下边代码
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using System.Runtime.Serialization.Formatters.Binary;
    using System.IO;
    namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            string conStr = "Data Source=.;Initial Catalog=text;Integrated Security=True";
            SqlConnection connection;
            public Form1()
            {
                InitializeComponent();
            }
            //显示
            private void button1_Click(object sender, EventArgs e)
            {
              connection = new SqlConnection(conStr);
                //二进制格式化器
                BinaryFormatter bf = new BinaryFormatter();            string sql = "select image from image";//自己加条件啊
                SqlCommand command = new SqlCommand(sql,connection);
                connection.Open();            byte[] arr = (byte[])command.ExecuteScalar();            MemoryStream s = new MemoryStream(arr);
                //反序列化
                this.pictureBox2.Image = (Image)bf.Deserialize(s);
                connection.Close();
            }        private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                DialogResult result = openFileDialog1.ShowDialog();
                if (result==DialogResult.OK)
                {
                    this.pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
                }        }
            //保存
            private void button2_Click(object sender, EventArgs e)
            {
                connection = new SqlConnection(conStr);
                //二进制格式化器
                BinaryFormatter bf = new BinaryFormatter();
                //内存流
                MemoryStream ms=new MemoryStream();
                //把图片格式化成二进制保存在内存流中
                bf.Serialize(ms, this.pictureBox1.Image);
                //转换成字节数组
                byte[] arr = ms.ToArray();
                //@image变量
                string sql = "insert into image(image) values(@image) ";
                SqlCommand command = new SqlCommand(sql,connection);
                //给变量赋值
                command.Parameters.Add("@image", SqlDbType.Image).Value = arr;
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
        }
    }
      

  9.   


    获取图片路径path
    FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read);
    byte [] b=new byte[fs.Length];
    fs.Read(b, 0, fs.Length);
    往数据库存,直接把字节数组Insert进去就行
    如果要建立Image,可以先讲字节数组放入内存流中,再生成Image
    MemoryStream ms = new MemoryStream(b);
    Image image = Image.FromStream(ms);这种方法就很好了
      

  10.   


    估计楼主是要传到web服务器上
    httpRequest?
      

  11.   


    Using wc As New Net.WebClient
         wc.UploadFile("http://www.baidu.com", "post", "c:\boot.ini")
    End Using
    就完事了,或用webclient的几个重载方法,比较方便啦.
    WebClient,也有异步方式
    如果还不爽,用httpwebrequest,再不爽就tcpclient,还不过瘾用socket.
      

  12.   

    是呀,就是使用Webclient这个类来处理的。
    还有就是使用最基本的http://模式模拟http方式去提交数据。
      

  13.   

    这个可以满足你的需求,先将图片存储到数据库,再需要用的时候就取出图片
    取出时记得也要用MemoryStream
      

  14.   


            //插入
            private void button6_Click(object sender, EventArgs e)
            {
                count = objFinfo.GetScalar(_hID);
                lb_imageCount.Text = count.ToString();
                FilesData files = new FilesData();
                files.Hid = _hID;
                files.FName = imageName.Text.ToString();
                files.FDate = Convert.ToDateTime(imageDate.Text.ToString());
                byte[] imageFile;
                imageFile = File.ReadAllBytes(ThumbnailPhotoFilePath);
                files.Files = imageFile;
                if (count == 0)
                {
                    files.FGroup = 1;
                }
                else
                {
                    count++;
                    files.FGroup = count;
                }            DataTable dt = objFinfo.GetSelectFiles(files.FName, _hID);
                if (dt.Rows.Count == 0)
                {
                    int result = objFinfo.InsertFiles(files);
                    if (result > 0)
                    {
                        MessageBox.Show("图像数据已经成功录入数据库", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        count = objFinfo.GetScalar(_hID);
                        lb_imageCount.Text = count.ToString();
                        lb_imageNow.Text = count.ToString();
                    }
                    else
                        MessageBox.Show("图像数据录入失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                    MessageBox.Show("该图片已存在,请重新插入!");
            }
            FilesData files = new FilesData();        //显示图片方法
            private void PicShow()
            {
                IDataReader dr = objFinfo.GetReader(_hID, index);
                if (dr.Read())
                {
                    files.Files = dr["files"] as byte[];
                    files.FName = dr["FName"].ToString();
                    files.FDate = Convert.ToDateTime(dr["FDate"]);
                    imageName.Text = files.FName;
                    imageDate.Text = files.FDate.ToString();
                    MemoryStream myStream = new MemoryStream();
                    foreach (byte p in files.Files)
                    {
                        myStream.WriteByte(p);
                    }
                    Image myImage = Image.FromStream(myStream);
                    pic_h.Image = myImage;
                    myStream.Close();
                }
            }
      

  15.   

    怎么在 winform中选择一个图片,把图片名称和图片路径获取显示在listview中
      

  16.   

    <asp:FileUpload ID="fupFile" runat="server" Width="190px" />、、 
    if (this.fupFile.HasFile)
                {
                    string extension = Path.GetExtension(fupFile.FileName);
                    if (".gif,.jpg,.pjpeg,.jpeg".Contains(extension.ToLower()))
                    {
                        string RecordID = b.Guid;
                        string fileName = RecordID + extension;
                        string path = Winstar.Framework.WebUI.AppConfig.SYS_Attachment + "Avatar" + "\\";                    if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }
                        fupFile.SaveAs(path + fileName);
                        b.Person_Image = fileName;
                    }
                    else
                    {
                        Response.Write("<script>alert('只能上传图片格式,请重新选择!');</script>");
                        return false;
                    }
                }