private void SaveToFile(string UploadDir, ref System.Web.HttpFileCollection UploadFile)
{
string FileName, FileExt;
int FileCnt;
long FileSize;
for (FileCnt = 0; FileCnt < UploadFile.Count; FileCnt++)
{
System.Web.HttpPostedFile CurFile = UploadFile.Get(FileCnt);
FileName = System.IO.Path.GetFileName(CurFile.FileName);
FileSize = CurFile.ContentLength / 1000; // Kbyte 단위
if(FileName != "")
{
FileExt = System.IO.Path.GetExtension(FileName);
if (FileExt == ".aspx" || FileExt == ".asp")
{
myFunction.PrintMsgBack("확장자가 asp, aspx 파일은 업로드 하실수 없습니다.");
}
else
{
FileInfo saveFile;
do
{
saveFile = new FileInfo(UploadDir + FileName);
if(saveFile.Exists)
{
FileName = FileName.Replace(".","1.");
}
}
while(saveFile.Exists);
FileNames += FileName + (char)5;
FileSizes += FileSize.ToString() + (char)5;
CurFile.SaveAs(UploadDir + FileName);
}
}
}
}