none
Uploading Image RRS feed

  • Question

  • Friends I am using winforms and I want to upload the image in the project folder whose location is given in the textbox on clicking the upload button..

    Please help me if possible..


    Wednesday, December 25, 2013 6:32 PM

Answers

  • What do you mean by upload?

    You have a textbox with the location of the path, correct?
    You also have a button which should move the file to your project folder?

    Sounds like a simple Copy function?

    private void btnCopyID_Click(object sender, EventArgs e)
    {
        var location = txtPathID.Text;
        var destination = string.Format(@"{0}\{1}"
            , Directory.GetCurrentDirectory()
            , Path.GetFileName(location));
    
        File.Copy(location, destination);
    }

    Wednesday, December 25, 2013 6:44 PM

All replies

  • What do you mean by upload?

    You have a textbox with the location of the path, correct?
    You also have a button which should move the file to your project folder?

    Sounds like a simple Copy function?

    private void btnCopyID_Click(object sender, EventArgs e)
    {
        var location = txtPathID.Text;
        var destination = string.Format(@"{0}\{1}"
            , Directory.GetCurrentDirectory()
            , Path.GetFileName(location));
    
        File.Copy(location, destination);
    }

    Wednesday, December 25, 2013 6:44 PM
  • I assume that you mean downloading. 

    However, that is not a windows forms class. 

    Try to ask follow up things around this in the forum of your program language because there are many ways but not related to windows forms. 

    The easiest way is mostly this one. 

    http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile(v=vs.110).aspx

     If it is really uploading then it depends on the technology which the server uses and is in fact even more less related to windows forms.


    Success
    Cor


    Friday, December 27, 2013 7:15 PM