473,728 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Download file to local file system

I am working on a player application for my podcast, currently all it
does is make a Windows Media Player control open the MP3 file you select
from a listbox populated by the RSS feed. I am trying to add a 'save'
feature that downloads the MP3 to the local file system, but everything
I have tried has resulted in corrupt files. Can anyone help?
Jan 12 '06 #1
5 1643
Stefan,

Can you show your code, what you have already? It would help serve as a
base.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Stefan Nuxoll" <ne******@gmail .com> wrote in message
news:11******** *****@corp.supe rnews.com...
I am working on a player application for my podcast, currently all it does
is make a Windows Media Player control open the MP3 file you select from a
listbox populated by the RSS feed. I am trying to add a 'save' feature
that downloads the MP3 to the local file system, but everything I have
tried has resulted in corrupt files. Can anyone help?

Jan 12 '06 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Stefan,

Can you show your code, what you have already? It would help serve as a
base.

I kind of deleted all of my code in anger, but basically it opened a
save dialog, instanced a webclient, read the file line by line and
copied it into a stream at the location the user choose in the save
dialog. I am guessing reading the file in the fashion I am doing is the
issue?
Jan 12 '06 #3
Yep, since it's a binary file you want to read and write the file in
bytes instead of line by line. Otherwise it will read in "lines" that
may or may not exist, and when it's writing those lines it will remove
whatever character it deems is a line break and replace it with the
current environment's line break thus corrupting the file.

--
Benny Raymond
http://bloatedcowsoftware.com

Stefan Nuxoll wrote:
Nicholas Paldino [.NET/C# MVP] wrote:
Stefan,

Can you show your code, what you have already? It would help
serve as a base.

I kind of deleted all of my code in anger, but basically it opened a
save dialog, instanced a webclient, read the file line by line and
copied it into a stream at the location the user choose in the save
dialog. I am guessing reading the file in the fashion I am doing is the
issue?

Jan 12 '06 #4
How would you suggest doing this than, do I still have to go the stream
approach or is there some magic, copy from URL to local filesystem
command?

Jan 12 '06 #5
This should do it:

WebClient Client = new WebClient();

try

{

Client.Download File(RemoteFile Url, LocalFileName);

}

"Stefan Nuxoll" <ne******@gmail .com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
How would you suggest doing this than, do I still have to go the stream
approach or is there some magic, copy from URL to local filesystem
command?

Jan 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4229
by: gb | last post by:
hi, i placed System.Windows.Forms.WebBrowser in my WinForm. When i tried loading word document, it opens the File Download window. My question is how can i avoid the File Download window from showing? My intented default action is to always open Open file, just like if i load image, text file or xml file where it does not show the File Download dialog. I dont want to override user preference to always show File Download window.
1
2253
by: theburnetts | last post by:
I am building an ASP.NET application that has a requirement that the user should be able to download all of the data that they have input into the system and save it to a file on their local PC. Then at some future time they should be able to upload it back to the web server and continue working on it. (Don't ask me why they have to be able to do this. Apparently the users are super paranoid about saving their data to the server and...
2
6964
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
0
827
by: ichi32 | last post by:
Hello, I want to know how to use the System.Net.WebClient in my application. Here is the part of the code: System.Net.WebClient client = new System.Net.WebClient(); client.DownloadFile("http://updates.com/index.xml","c:\\update.xml"); That would download the file "index.xml" and save it in the local computer in drive C under a new name "update.xml". I would like my application to determine the file size of the file to be...
0
8753
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9411
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9265
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9188
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8113
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6704
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6012
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2159
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.