Click here to Skip to main content
15,883,872 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do you enforce use of dedicated factories? Pin
Clifford Nelson7-Mar-12 7:55
Clifford Nelson7-Mar-12 7:55 
GeneralRe: How do you enforce use of dedicated factories? Pin
lmoelleb8-Mar-12 1:39
lmoelleb8-Mar-12 1:39 
AnswerRe: How do you enforce use of dedicated factories? Pin
lmoelleb8-Mar-12 1:48
lmoelleb8-Mar-12 1:48 
Questionopen new tab in ie,mozilla and google chrome browers Pin
Rajkumartag6-Mar-12 0:02
Rajkumartag6-Mar-12 0:02 
AnswerRe: open new tab in ie,mozilla and google chrome browers Pin
Eddy Vluggen6-Mar-12 0:37
professionalEddy Vluggen6-Mar-12 0:37 
AnswerRe: open new tab in ie,mozilla and google chrome browers Pin
BobJanova6-Mar-12 0:41
BobJanova6-Mar-12 0:41 
GeneralRe: open new tab in ie,mozilla and google chrome browers Pin
Vasudevan Deepak Kumar9-Mar-12 9:59
Vasudevan Deepak Kumar9-Mar-12 9:59 
QuestionFile upload using http Pin
Sebastian T Xavier5-Mar-12 18:55
Sebastian T Xavier5-Mar-12 18:55 
Hello All,

I need to upload files to a server using http in a windows application. Is that possible? I have got some examples using HttpPostedFile , but that is in web application. The code is given below...
C#
if( filMyFile.PostedFile != null )
   {
      HttpPostedFile myFile = filMyFile.PostedFile;
      int nFileLen = myFile.ContentLength; 
      if( nFileLen > 0 )
      {
	byte[] myData = new byte[nFileLen];
	myFile.InputStream.Read(myData, 0, nFileLen);
	string strFilename =          
        Path.GetFileName(myFile.FileName);
        FileStream newFile = new FileStream(strPath,   
        FileMode.Create);
	newFile.Write(Buffer, 0, Buffer.Length);
	newFile.Close();
     }
  }


I have placed an openfiledialog in a windows form and used the following code..
C#
FileInfo fileInf = new FileInfo(openFileDialog1.FileName);


But how I can assign this FileInfo to HttpPostedFile. Any help would be appreciated.

Thanks in advance...
Sebastian
AnswerRe: File upload using http Pin
Pete O'Hanlon5-Mar-12 21:43
mvePete O'Hanlon5-Mar-12 21:43 
GeneralRe: File upload using http Pin
Sebastian T Xavier5-Mar-12 22:03
Sebastian T Xavier5-Mar-12 22:03 
AnswerRe: File upload using http Pin
DonDiegoDeLaVega5-Mar-12 21:49
DonDiegoDeLaVega5-Mar-12 21:49 
GeneralRe: File upload using http Pin
Sebastian T Xavier5-Mar-12 22:03
Sebastian T Xavier5-Mar-12 22:03 
QuestionMerge cell in datagrid C# Pin
daitranthanhhoa5-Mar-12 16:14
daitranthanhhoa5-Mar-12 16:14 
AnswerRe: Merge cell in datagrid C# Pin
Dave Kreskowiak5-Mar-12 16:18
mveDave Kreskowiak5-Mar-12 16:18 
QuestionWeb Browser to C# application Pin
TKCA5-Mar-12 15:54
TKCA5-Mar-12 15:54 
AnswerRe: Web Browser to C# application Pin
Dave Kreskowiak5-Mar-12 16:18
mveDave Kreskowiak5-Mar-12 16:18 
GeneralRe: Web Browser to C# application Pin
TKCA5-Mar-12 16:56
TKCA5-Mar-12 16:56 
GeneralRe: Web Browser to C# application Pin
Dave Kreskowiak5-Mar-12 17:03
mveDave Kreskowiak5-Mar-12 17:03 
GeneralRe: Web Browser to C# application Pin
TKCA7-Mar-12 2:24
TKCA7-Mar-12 2:24 
GeneralRe: Web Browser to C# application Pin
Dave Kreskowiak7-Mar-12 3:57
mveDave Kreskowiak7-Mar-12 3:57 
Questionrandom selection from a list Pin
james bradbery5-Mar-12 14:57
james bradbery5-Mar-12 14:57 
AnswerRe: random selection from a list Pin
PIEBALDconsult5-Mar-12 15:06
mvePIEBALDconsult5-Mar-12 15:06 
GeneralRe: random selection from a list Pin
james bradbery5-Mar-12 15:12
james bradbery5-Mar-12 15:12 
AnswerRe: random selection from a list Pin
RobCroll5-Mar-12 15:16
RobCroll5-Mar-12 15:16 
GeneralRe: random selection from a list Pin
james bradbery5-Mar-12 16:30
james bradbery5-Mar-12 16:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.