示例#1
0
        /// <summary>
        /// Upload selected file
        /// </summary>
        private void button_upload_Click(object sender, EventArgs e)
        {
            DrutNETBase.OnCurlDataProgress += new DrutNETBase.CurlDataProgressDel(DrutNETBase_OnCurlDataProgress);
            progressBar1.Value              = 0;
            int fid;

            if ((fid = _curlCon.FileUpload(textBox1.Text)) == -1)
            {
                DrutNETBase_OnUpdateLog("Unable to upload file \n", "Drutnet Sample", Enums.MessageType.Error, false);
            }
            else
            {
                // Add a file to the node
                if (textBox_fileNode.Text != "")
                {
                    int nid = Convert.ToInt32(textBox_fileNode.Text);
                    _serviceCon.AttachFileToNode(textBox_fieldName.Text, fid, 0, nid);
                }
                DrutNETBase_OnUpdateLog("File uploaded successfully to FID :" + fid + "\n", "Drutnet Sample", Enums.MessageType.Info, false);
            }
        }