How can I upload a file or we can say choose a file from the system in Visual C++ Form Application [closed]

StackOverflow https://stackoverflow.com/questions/23580837

Question

As I want to make an application in which a user can choose a Image file for the Image processing that is in my sense some thing dynamic image. In html this is some thing like this

    <h1>File Upload with Jersey</h1>
    <form action="rest/hello/upload" method="post" enctype="multipart/form-data">
       <p>
           Select a file : <input type="file" name="file" size="45" />
       </p> 

Now how to make this this thing in VC++. Please Suggest me some tutorial or some thing help full.

Thanks in Advance.

Was it helpful?

Solution

Here is the code for this task

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                  // Displays an OpenFileDialog so the user can select a Cursor.
              OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog();
              openFileDialog1->Filter = "Cursor Files|*.cur";
              openFileDialog1->Title = "Select a Cursor File";

              // Show the Dialog.
              // If the user clicked OK in the dialog and
              // a .CUR file was selected, open it.
              if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
              {
                 // Assign the cursor in the Stream to
                 // the Form's Cursor property.
                 this->Cursor = gcnew
                    System::Windows::Forms::Cursor(
                    openFileDialog1->OpenFile());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top