asp.net - 从二进制文件获取图像并存储在文件夹中

标签 asp.net vb.net

我创建了一个提供图像上传功能的网站。 我以二进制格式插入了图像,并且还将完成编辑和删除,但现在要求将发生变化。

首先我将插入逻辑放在这里。

  <tr>
                            <td valign="top" align="left" class="LabelFont">Logo :
                            </td>
                            <td width="74%" valign="top" align="left">
                                <asp:FileUpload ID="flLogo" runat="server"/> 

                            </td>
                        </tr>

并在代码后面...

If (flLogo.HasFile.ToString()) Then
                Dim File As HttpPostedFile = flLogo.PostedFile
                imgByte = New Byte(File.ContentLength - 1) {}
                File.InputStream.Read(imgByte, 0, File.ContentLength)

所以在 imagebyte 中我得到了二进制图像,然后插入数据库......

NOW MY Question Start. my boss ask me that get image from binary and store in folder with max Cust_id.

那么如何将二进制图像中的图像保存到文件夹中?

提前致谢

最佳答案

您可以直接保存图像:

Dim bmp As New Bitmap(flLogo.PostedFile.InputStream)
bmp.Save(yourPath)

关于asp.net - 从二进制文件获取图像并存储在文件夹中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30410364/

相关文章:

c# - Asp.net 身份哈希安全吗?

c# - 多线程时如何使用 HttpContext.Current?

asp.net - OneDrive for Business :"invalid_request","error_description":"AADSTS90014: The request body must contain the following parameter: ' grant_type

c# - 查看 Excel 是否处于 .NET 中的单元格编辑模式的解决方法

XML 转义字符

asp.net - azure 连接字符串格式 - 添加 azure

c# - 找不到 ObjectDataSource 的 TypeName 属性中指定的类型

mysql - 如何计算时间差并将结果存储在 mySQL 数据库 (VB.NET) 中?

mysql - 使用 VB.NET 通过 SSL 远程访问 MySQL

asp.net - 将 @font-face 与 ABCPDF 一起使用?或者有其他方法将字体转换为 PDF 吗?