Upload/Download Files
Use this board to post your code snippets - tips and tricks
Hello,
This snip will show you the simple way of Downloading and Uploading files to/from a website.
First you need to have 2 imports at the top of your code:
Download a file:
Uploading a file:
And thats all you need to do. Simple and easy.
Happy Coding.
This snip will show you the simple way of Downloading and Uploading files to/from a website.
First you need to have 2 imports at the top of your code:
Code: Select all
Then use the following codes to do the corresponding action.Imports System.Net
Imports System.IO
Download a file:
Code: Select all
My.Computer.Network.DownloadFile("http://www.WEBSITE.com/NameOfFile.ext", "SaveAs.ext")
Uploading a file:
Code: Select all
My.Computer.Network.UploadFile("FileToUpload.ext", "ftp://www.WEBSITE.com/StoreFileAs.ext", "USERNAME", "PASSWORD", True, 10, FileIO.UICancelOption.DoNothing)
And thats all you need to do. Simple and easy.
Happy Coding.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
I used your snippet to successfully produce a Youtube Video Downloader ^^
Guess what... Both uploading and downloading videos works!
Guess what... Both uploading and downloading videos works!

Not uploader, I said DOWNLOADER ^^
Well, since youtube downloads itself the videos for each time you see them you can use the feed you're receiving from youtube to save the file in your desktop instead of making a temporary file in your internet browser's cookies folder.
Well, since youtube downloads itself the videos for each time you see them you can use the feed you're receiving from youtube to save the file in your desktop instead of making a temporary file in your internet browser's cookies folder.
Last edited by Nery on Tue Nov 10, 2009 10:30 am, edited 1 time in total.
I don't get this part:
My.Computer.Network.DownloadFile("http://www.WEBSITE.com/NameOfFile.ext", ">>SaveAs.ext<<")
What should I change SaveAs.ext to? .exe? or what? Give me an example please.
My.Computer.Network.DownloadFile("http://www.WEBSITE.com/NameOfFile.ext", ">>SaveAs.ext<<")
What should I change SaveAs.ext to? .exe? or what? Give me an example please.
Hello,
Thats the name of the file you want to save it as on your computer. For example if I wanted to download a file from the website called "Application.zip" and I wanted to save it on my computer as "MyApp.zip" I would use the code like this:
Hope that helps cooll;
Thats the name of the file you want to save it as on your computer. For example if I wanted to download a file from the website called "Application.zip" and I wanted to save it on my computer as "MyApp.zip" I would use the code like this:
Code: Select all
So the first part is the URL and name of the file you want to download. The second part is what you want to save the file as when its downloaded.My.Computer.Network.DownloadFile("http://www.WEBSITE.com/Application.zip", "MyApp.zip")
Hope that helps cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Thanks,
But the problem NOW is, say my code is this:
My.Computer.Network.DownloadFile(TextBox1.Text, ">>>MyApp.zip<<<")
How can I make my program figure out what the extension is?
I think I have an IDEA of what to do:
My.Computer.Network.DownloadFile(TextBox1.Text, TextBox2.Text)
And make the user type what they want to save it as(the name) AND the extension at the end?
But the problem NOW is, say my code is this:
My.Computer.Network.DownloadFile(TextBox1.Text, ">>>MyApp.zip<<<")
How can I make my program figure out what the extension is?
I think I have an IDEA of what to do:
My.Computer.Network.DownloadFile(TextBox1.Text, TextBox2.Text)
And make the user type what they want to save it as(the name) AND the extension at the end?
Copyright Information
Copyright © Codenstuff.com 2020 - 2023