private System.Boolean SaveImages() {
//循環處理上傳文件
System.Web.HttpFileCollection _files = System.Web.HttpContext.Current.Request.Files;
//用戶UI信息
System.Text.StringBuilder _message = new System.Text.StringBuilder("文件上傳:<br>");
try
{
for ( System.Int32 _iFile = 0; _iFile < _files.Count; _iFile ++ )
{
//檢查上傳文件的類型,默認有gif和jpg
System.Web.HttpPostedFile _postedFile = _files[_iFile];
System.String _fileName, _fileExtension;
_fileName = System.IO.Path.GetFileName(_postedFile.FileName);
_fileExtension = System.IO.Path.GetExtension(_fileName);
if ( _fileExtension == ".gif" )
{
//保存文件的相對路徑
_postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("gifs/") + _fileName);
_message.Append(_fileName + "<BR>");
}
else if ( _fileExtension == ".jpg" )
{
//保存文件的相對路徑
_postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("jpgs/") + _fileName);
_message.Append(_fileName + "<BR>");
}