怎样用asp实现图片上传到文件夹,路径保存在 sql数据库中

怎样用asp实现图片上传到文件夹,路径保存在sql数据库中
2024-11-24 15:53:05
推荐回答(1个)
回答1:

savefilename = Server.MapPath("../GoodsView/upfile")+"/" + filename1; FileInfo f_name = new FileInfo(File1.PostedFile.FileName); string s1 = f_name.Extension.ToString(); //取得后缀名 if( s1 == ".jpg" || s1 == ".gif" || s1 == ".JPG" || s1 == ".GIF") { if ( File1.PostedFile.ContentLength < 140000 ) { File1.PostedFile.SaveAs(Server.MapPath("../GoodsView/upfile")+"/" + filename1 + ".jpg"); //saveSQLStr = "GoodsView/upfile/" + filename1; saveSQLStr = filename1; return saveSQLStr; } else { Response.Write(""); return null; } } else { Response.Write(""); return null; }

希望采纳