Click here to Skip to main content
       

C#

 
GeneralRe: image resizing Pinmembervimalbala23-Mar-13 2:30 
QuestionC# Money Transfer Question [modified] PinmemberJimmy173420-Feb-13 19:10 
QuestionRe: C# Money Transfer Question PinmvpEddy Vluggen21-Feb-13 9:40 
QuestionMD5 hash encrypt and decryption Pinmemberthekoko8920-Feb-13 16:32 
GeneralRe: MD5 hash encrypt and decryption PinmemberPIEBALDconsult20-Feb-13 18:18 
AnswerRe: MD5 hash encrypt and decryption PinmemberBernhard Hiller20-Feb-13 22:12 
AnswerRe: MD5 hash encrypt and decryption PinmvpDave Kreskowiak21-Feb-13 3:34 
QuestionPost a file to remote server using HTTPWEBREQUEST Pinmembervanikanc20-Feb-13 10:07 
Hello,
 
Below is a piece of code, where in I am trying to post a file from my pc to remote development server. For some reason it does not seem to be working. I don't see the file on the remote server.
 
        private void button2_Click(object sender, EventArgs e)
        {
            FileStream filetoupload = new FileStream("C:\\projects\\testfile.csv", FileMode.Open);
            Uri address = new Uri("http://devsrvr/hints/");
 
            HttpWebRequest webreq = HttpWebRequest.Create(address) as HttpWebRequest;
 
            // set type to post
            webreq.Method = "POST";
            webreq.ContentType = "application/x-www-form-urlencoded";
            webreq.Timeout = 15 * 1000;  
            // data we want to send, which is pretty much a file
                      
            byte[] bytedata = UTF8Encoding.UTF8.GetBytes(filetoupload.ToString());
            webreq.ContentLength = bytedata.Length;
 
            try
            {
                using (Stream poststream = webreq.GetRequestStream())
                {
                    poststream.Write(bytedata, 0, bytedata.Length);
                }
                MessageBox.Show("done!!");
            }
            catch (Exception ex)
            {
                ex.InnerException.ToString();
                ex.Source.ToString();
                ex.Message.ToString();
            }
        }

AnswerRe: Post a file to remote server using HTTPWEBREQUEST PinmvpEddy Vluggen20-Feb-13 10:51 
GeneralRe: Post a file to remote server using HTTPWEBREQUEST Pinmembervanikanc20-Feb-13 11:04 
AnswerRe: Post a file to remote server using HTTPWEBREQUEST PinmvpEddy Vluggen20-Feb-13 11:13 
GeneralRe: Post a file to remote server using HTTPWEBREQUEST Pinmembervanikanc21-Feb-13 3:53 
AnswerRe: Post a file to remote server using HTTPWEBREQUEST PinprotectorPete O'Hanlon20-Feb-13 11:18 
GeneralRe: Post a file to remote server using HTTPWEBREQUEST Pinmembervanikanc21-Feb-13 3:49 
Questionsource code for navigation PinmemberNani Maneesh20-Feb-13 8:07 
AnswerRe: source code for navigation PinmvpDave Kreskowiak20-Feb-13 8:38 
GeneralRe: source code for navigation PinmemberJibesh20-Feb-13 9:32 
GeneralRe: source code for navigation PinmvpDave Kreskowiak20-Feb-13 12:24 
QuestionHow to Show GIF Image Transparent C# Pinmemberishrar19-Feb-13 22:53 
AnswerRe: How to Show GIF Image Transparent C# PinmemberAlan Balkany20-Feb-13 9:28 
QuestionInstall software and menus depending upon radion button selection option used in MSI Pinmembersjs4u19-Feb-13 20:33 
AnswerRe: Install software and menus depending upon radion button selection option used in MSI PinmvpEddy Vluggen20-Feb-13 1:31 
GeneralRe: Install software and menus depending upon radion button selection option used in MSI Pinmembersjs4u20-Feb-13 19:12 
GeneralRe: Install software and menus depending upon radion button selection option used in MSI PinmvpEddy Vluggen21-Feb-13 8:06 
Questionproject Pinmemberpramodrastogi9119-Feb-13 19:14 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 25 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid