且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows窗体应用程序中上传和下载doc,pdf文件...

更新时间:2022-11-05 13:47:27

试试此链接.. [ ^ ]


上传文件并将其保存在数据库中:

您可以使用以下代码c#



Uploading the file and saving it in your database:
You can use the following code c#

private void pdfuploadBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog Openpdf = new OpenFileDialog();
            Openpdf.Filter = "PDF files|*.pdf|All files|*.*;";
            if (Openpdf.ShowDialog() == DialogResult.OK)
            {
                string pdfLog = Openpdf.FileName.ToString();
                pdfUploadbox.Text = pdfLog;
                axAcroPDF1.src = Openpdf.FileName;
                //pdfUploadbox.Text = pdfLog;
            }
            if (axAcroPDF1.src == null)
            {
                MessageBox.Show("Try new file");
            }
            else { MessageBox.Show("PDF Uploaded"); }

        }