hye .... 다소 긴급한 ... iam 임시 폴더를 사용하여 미리보기 용 이미지를 저장하고 System.Runtime.InteropServices.ExternalException을 저장하려고하면 GDI + erreo에서 일반적인 오류가 발생했습니다. 보고 ... 는 문자열 =는 Server.MapPath ("./ TempImages /") 새로운에서는 FileInfo으로 희미한 oFileInfo (FileUpload1.PostedFile.FileName)로 FileUpload1.HasFile 다음 희미한 경로는System.Runtime.InteropServices.ExternalException : GDI +에서 일반 오류가 발생했습니다. imp
Dim fileName As String = oFileInfo.Name
Dim fullFileName As String = path + "\\" + fileName
Dim imagePath As String = "TempImages/" + fileName
If Not Directory.Exists(path) Then
Directory.CreateDirectory(path)
End If
FileUpload1.PostedFile.SaveAs(fullFileName)
Image1.ImageUrl = imagePath
이 무엇을 경우 iam은 저장하고 저장합니다.
If (FileUpload1.HasFile) Then Dim 문자열 = System.IO.Path.GetExtension (FileUpload1.FileName) 것처럼 strextension (strextension.ToUpper() = ".JPG") 다음은
Dim imagetoberezised As System.Drawing.Image = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream)
Dim imageheight As Integer = imagetoberezised.Height
Dim imagewidth As Integer = imagetoberezised.Width
Dim maxheight As Integer = 120
Dim maxwidth As Integer = 80
imageheight = (imagewidth * maxheight)/imageheight
imagewidth = maxheight
If imageheight > maxheight Then
imageheight = (imagewidth * maxheight)/imageheight
imagewidth = maxheight
End If
Dim bitmap As New Bitmap(imagetoberezised, imagewidth, imageheight)
Dim stream As System.IO.MemoryStream = New MemoryStream()
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
stream.Position = 0
Dim img As Byte() = New Byte(stream.Length) {}
stream.Read(img, 0, img.Length)
Dim conn5 As New SqlConnection
conn5 = New SqlConnection
conn5.ConnectionString = "Server=aa-pc;Database=abcc;Uid=sa;[email protected];"
Try
conn5.Open()
Dim sql As String = "update abcset abc_IMAGE = @eimg where PART_NO=" & Val(Part_List.SelectedValue)
Dim cmd5 As SqlCommand = New SqlCommand(sql, conn5)
Dim uploadimage As New SqlParameter("@eimg", SqlDbType.Image, img.Length)
uploadimage.Value = img
cmd5.Parameters.Add(uploadimage)
Dim id As Integer = Convert.ToInt32(cmd5.ExecuteScalar())
Catch
MsgBox("error")
Finally
conn5.Close()
End Try
End If
End If
우리가 서버에서 로컬이 아닌 실행 whilw 잘 작동 ..