using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsAppFinal { public partial class Form1 : Form { WebClient client = new WebClient(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { string url = textBox1.Text.Trim(); if (string.IsNullOrEmpty(url)) { label1.Text = "Please enter a download URL."; return; } string savePath = "C:\\Users\\AKHILESH\\OneDrive\\Desktop\\download.txt"; client.DownloadFile(url, savePath); label1.Text = "File downloaded to " + savePath; } catch (Exception ex) { label2.Text = "Error: " + ex.Message; } } private void button2_Click(object sender, EventArgs e) { try { string url = textBox2.Text; // Example: https://httpbin.org/post string filePath = "C:\\Users\\AKHILESH\\OneDrive\\Desktop\\dummy.txt"; client.UploadFile(url, "POST", filePath); MessageBox.Show("File uploaded successfully!"); label2.Text = "Upload completed"; } catch (Exception ex) { label2.Text = "Error: " + ex.Message; } } } } https://raw.githubusercontent.com/vinta/awesome-python/master/README.md https://httpbin.org/post
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter