如何在不使用fileupload控件的情况下将图像插入数据库

问题描述:

以独特而简单的方式给出答案

give me a answer in the unique and simple way

将图像保存到数据库很容易:为什么我得到参数无效。我从数据库中读取图像时出现异常? [ ^ ]显示了如何做到这一点。



但是没有使用fileupload控件部分暗示您希望从客户端PC获取它并将其保存在服务器上。除非在特殊情况下(99.99%的情况下不会发生),否则您无法执行此操作:您无权访问客户端硬盘。所有这些转移必须由客户以这种或那种方式启动 - 需要某种形式的文件上传控制。
Saving an image to a DB is easy: Why do I get a "Parameter is not valid." exception when I read an image from my database?[^] shows how to do that.

But the "without using fileupload control" part implies that you want to get it from a client PC and save it at the server. Except in exceptional circumstances (which don't occur in 99.99% of cases) you can't do that: you do not have access to the client hard disk. All such transfers must be initiated by the client in one way or another - a file upload control of some form is required.