代码如下:
If gs_logo.HasFile Then
Dim image As System.Drawing.Image = System.Drawing.Image.FromFile(fileName)
dim width as string = image.Width
dim height as string = image.Height
If width < 300 Then
If height < 150 Then
Try
PathStr = Server.MapPath("abc.mdf")
PathStr = IO.Path.GetDirectoryName(PathStr) & IO.Path.DirectorySeparatorChar
PathStr = PathStr & "biaozhi" & IO.Path.DirectorySeparatorChar
PathStr &= IO.Path.GetFileNameWithoutExtension(gs_logo.FileName) & Now.ToString("ddHHmmss") & IO.Path.GetExtension(gs_logo.FileName)
gs_logo.SaveAs(PathStr)
Catch ex As Exception
Exit Sub
End Try
else
...
end if
else
...
end if
end if
我在本地测试成功,但上传到虚拟空间里就报错,在网上搜了一下,说是要先将图片先保存到服务器上,再判断,请问各位,应该怎样修改一下呢?
若图片合格,就保存;不合格,就删除?你这个是吧服务器的图片保存在数据库吧??
不是把客户端的图片保存……