虚拟服务器上的图片上传问题
图片上传,本地测试没有问题,
Image img = Image.FromFile(photoOriginalName, true);
监视:photoOriginalName = "C:\Documents and Settings\judyjiao\桌面\Supplement.gif "
可是上传到服务器上,Image img = Image.FromFile(photoOriginalName, true);
就出了问题。请问是什么问题呢?应该不是权限问题吧,这里是上穿图片。
全部代码如下:
public static bool UploadPhoto(HtmlInputFile file, string photoName)
{
bool retValue = false;
string photoOriginalName = file.PostedFile.FileName;
Image img = Image.FromFile(photoOriginalName, true);
try
{
switch (SpecailTopicPhotoType.Trim().ToUpper())
{
case "BMP ":
img.Save(PhotoNewPath + photoName + @ ".bmp ", ImageFormat.Bmp);
break;
case "JPG ":
img.Save(PhotoNewPath + photoName + @ ".jpg ", ImageFormat.Jpeg);
break;
case "GIF ":
img.Save(PhotoNewPath + photoName + @ ".gif ", ImageFormat.Gif);
break;
case "TIF ":
img.Save(PhotoNewPath + photoName + @ ".tif ", ImageFormat.Tiff);
break;
}