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
- Win32Exception.cs
- WebPartTransformerCollection.cs
- DeviceContexts.cs
- UserMapPath.cs
- AnnotationComponentManager.cs
- MetadataHelper.cs
- IsolatedStorageFileStream.cs
- AsyncPostBackErrorEventArgs.cs
- VisualStyleTypesAndProperties.cs
- RewritingValidator.cs
- DependsOnAttribute.cs
- TrackBar.cs
- DataGridViewColumnEventArgs.cs
- XmlMembersMapping.cs
- ToolStripManager.cs
- MouseBinding.cs
- TextWriterTraceListener.cs
- FeatureManager.cs
- InvalidPropValue.cs
- PhonemeConverter.cs
- SQLByteStorage.cs
- Accessors.cs
- DbXmlEnabledProviderManifest.cs
- LabelAutomationPeer.cs
- TreeNodeCollection.cs
- XmlSigningNodeWriter.cs
- Tokenizer.cs
- _LocalDataStoreMgr.cs
- ObjectDisposedException.cs
- SoapInteropTypes.cs
- VisualBrush.cs
- LinkTarget.cs
- NavigationHelper.cs
- Expr.cs
- NativeMethods.cs
- AsyncOperation.cs
- IndexedEnumerable.cs
- LocalTransaction.cs
- ValidatorCollection.cs
- RegexStringValidatorAttribute.cs
- ComboBox.cs
- wmiprovider.cs
- CheckoutException.cs
- PageTrueTypeFont.cs
- TeredoHelper.cs
- UIServiceHelper.cs
- GenerateTemporaryTargetAssembly.cs
- DescendantOverDescendantQuery.cs
- SizeLimitedCache.cs
- NetMsmqBindingElement.cs
- EntityDataSourceValidationException.cs
- SqlDataReaderSmi.cs
- CollectionViewGroupInternal.cs
- StrokeRenderer.cs
- Util.cs
- TreeViewAutomationPeer.cs
- WebPartVerbsEventArgs.cs
- dbenumerator.cs
- DataBindingCollection.cs
- RadioButtonList.cs
- EndpointAddress10.cs
- TextContainerHelper.cs
- SpotLight.cs
- InheritablePropertyChangeInfo.cs
- LineProperties.cs
- TableLayoutPanel.cs
- DescendantQuery.cs
- ClassValidator.cs
- ContentElementAutomationPeer.cs
- HtmlInputFile.cs
- ClientSideQueueItem.cs
- PackWebRequestFactory.cs
- DataContract.cs
- ExitEventArgs.cs
- SqlRecordBuffer.cs
- ResolveRequestResponseAsyncResult.cs
- WMIInterop.cs
- PatternMatcher.cs
- RecommendedAsConfigurableAttribute.cs
- SByteStorage.cs
- InvalidPropValue.cs
- DataGridLinkButton.cs
- SinglePageViewer.cs
- BuildResultCache.cs
- CultureSpecificStringDictionary.cs
- XamlDesignerSerializationManager.cs
- HwndProxyElementProvider.cs
- ScrollItemProviderWrapper.cs
- WebServiceHostFactory.cs
- XmlSchemaCollection.cs
- SharedPersonalizationStateInfo.cs
- ZipIOLocalFileHeader.cs
- XmlNodeReader.cs
- ItemsChangedEventArgs.cs
- SynchronizingStream.cs
- ResourceReferenceExpression.cs
- SR.cs
- ProgressBarBrushConverter.cs
- PropertySet.cs
- UriWriter.cs