日期:2014-05-17 浏览次数:20445 次
while ( true ) { sFilePath = System.IO.Path.Combine( sServerDir, sFileName ); if ( System.IO.File.Exists( sFilePath ) ) { iCounter++; sFileName = sFileNameNoExt + "(" + iCounter + ")" + System.IO.Path.GetExtension( oFile.FileName ); iErrorNumber = Errors.UploadedFileRenamed; } else { oFile.SaveAs( sFilePath ); if ( Config.Current.SecureImageUploads && ImageTools.IsImageExtension( sExtension ) && !ImageTools.ValidateImage( sFilePath ) ) { System.IO.File.Delete( sFilePath ); ConnectorException.Throw( Errors.UploadedCorrupt ); } Settings.Images imagesSettings = Config.Current.Images; if ( imagesSettings.MaxHeight > 0 && imagesSettings.MaxWidth > 0 ) { ImageTools.ResizeImage( sFilePath, sFilePath, imagesSettings.MaxWidth, imagesSettings.MaxHeight, true, imagesSettings.Quality ); if ( Config.Current.CheckSizeAfterScaling && this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 ) { long fileSize = new System.IO.FileInfo( sFilePath ).Length; if ( fileSize > this.CurrentFolder.ResourceTypeInfo.MaxSize ) { System.IO.File.Delete( sFilePath ); ConnectorException.Throw( Errors.UploadedTooBig ); } } } break; } }
------解决方案--------------------
修改 ckfinder\_source\Connector\CommandHandlers\FileUploadCommandHandler.cs 文件
string sExtension = System.IO.Path.GetExtension( oFile.FileName ); sExtension = sExtension.TrimStart( '.' ); sFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "." + sExtension;