Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / HttpPostedFile.cs / 1305376 / HttpPostedFile.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * HttpCookie - collection + name + path * * Copyright (c) 1998 Microsoft Corporation */ namespace System.Web { using System.IO; using System.Security.Permissions; using System.Configuration; using System.Web.Configuration; using System.Web.Management; ////// public sealed class HttpPostedFile { private String _filename; private String _contentType; private HttpInputStream _stream; internal HttpPostedFile(String filename, String contentType, HttpInputStream stream) { _filename = filename; _contentType = contentType; _stream = stream; } /* * File name */ ////// Provides a way to /// access files uploaded by a client. /// ////// public String FileName { get { return _filename;} } /* * Content type */ ////// Returns the full path of a file on the local browser's machine (for /// example, "c:\temp\test.txt"). /// ////// public String ContentType { get { return _contentType;} } /* * Content length */ ////// Returns the MIME content type of an incoming file sent by a client. /// ////// public int ContentLength { get { return (int)_stream.Length;} } /* * Stream */ ////// Returns the size of an uploaded file, in bytes. /// ////// public Stream InputStream { get { return _stream;} } /* * Save into file */ ////// Provides raw access to /// contents of an uploaded file. /// ////// public void SaveAs(String filename) { // VSWhidbey 82855 if (!Path.IsPathRooted(filename)) { HttpRuntimeSection config = RuntimeConfig.GetConfig().HttpRuntime; if (config.RequireRootedSaveAsPath) { throw new HttpException(SR.GetString(SR.SaveAs_requires_rooted_path, filename)); } } FileStream f = new FileStream(filename, FileMode.Create); try { _stream.WriteTo(f); f.Flush(); } finally { f.Close(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Initiates a utility method to save an uploaded file to disk. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommandBindingCollection.cs
- MouseGesture.cs
- ChannelSinkStacks.cs
- ScalarOps.cs
- Expander.cs
- CommandManager.cs
- ContextDataSource.cs
- SharedUtils.cs
- PropertyExpression.cs
- iisPickupDirectory.cs
- MappedMetaModel.cs
- OrderToken.cs
- XmlILModule.cs
- ChainOfDependencies.cs
- ItemCollection.cs
- ITextView.cs
- CommandEventArgs.cs
- MarkerProperties.cs
- SignatureResourcePool.cs
- WorkflowTimerService.cs
- ClaimTypeElementCollection.cs
- BulletedListEventArgs.cs
- HttpContextServiceHost.cs
- ModulesEntry.cs
- _ScatterGatherBuffers.cs
- TreeBuilderBamlTranslator.cs
- SlipBehavior.cs
- HttpPostedFile.cs
- SerializableAttribute.cs
- SizeKeyFrameCollection.cs
- SetStoryboardSpeedRatio.cs
- AttachedPropertyInfo.cs
- TabItemAutomationPeer.cs
- EncoderBestFitFallback.cs
- ContractType.cs
- ServiceParser.cs
- FontFamilyValueSerializer.cs
- URLMembershipCondition.cs
- RootContext.cs
- StateMachineDesignerPaint.cs
- EventLogReader.cs
- RectKeyFrameCollection.cs
- HttpListenerContext.cs
- DrawToolTipEventArgs.cs
- XmlBufferReader.cs
- ColorAnimationBase.cs
- GeneralTransform.cs
- ItemCollection.cs
- XslCompiledTransform.cs
- ThaiBuddhistCalendar.cs
- ContractsBCL.cs
- XmlNamespaceManager.cs
- GeometryCombineModeValidation.cs
- RequestCacheManager.cs
- AuthenticationModuleElementCollection.cs
- TransformConverter.cs
- DataGridViewCellValidatingEventArgs.cs
- AssemblyEvidenceFactory.cs
- AspCompat.cs
- ExpressionBuilder.cs
- PlaceHolder.cs
- CheckBoxField.cs
- InkCanvasSelectionAdorner.cs
- PageBuildProvider.cs
- LongPath.cs
- ImageAttributes.cs
- OleCmdHelper.cs
- DesignerMetadata.cs
- EventLogPermission.cs
- OdbcConnection.cs
- WrappedIUnknown.cs
- HebrewNumber.cs
- ClientProxyGenerator.cs
- DataTable.cs
- MenuItem.cs
- AffineTransform3D.cs
- TreeSet.cs
- ConfigXmlDocument.cs
- SystemTcpStatistics.cs
- VerificationException.cs
- DataTableClearEvent.cs
- DbXmlEnabledProviderManifest.cs
- DataFormats.cs
- NavigationHelper.cs
- TiffBitmapEncoder.cs
- Image.cs
- CalendarDesigner.cs
- DBCommand.cs
- DrawingDrawingContext.cs
- XmlParserContext.cs
- ConfigurationManagerInternalFactory.cs
- MatrixStack.cs
- ClosableStream.cs
- DetailsViewModeEventArgs.cs
- ActivityCollectionMarkupSerializer.cs
- oledbmetadatacollectionnames.cs
- SystemIcmpV4Statistics.cs
- BrushMappingModeValidation.cs
- EncoderParameters.cs
- TableCell.cs