473,388 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Pulling Files From a Web Site based on the URL path.

Hello,

I have a client that is feeding PDF files to me. They do not want me to
link to their files since that can put a strain on their bandwidth. What
they asked I do is download the file and store it on my server.

My question is, how do I download a file based on a url at runtime?

In other words, I have an xml file from my client with hundreds of PDF file
urls. I want to write a program that parses out the XML file and
automatically downloads the PDF files and places them locally on my server.

How would this be done?

I dont need to know how to parse the XML file or add the files to my server.
I just need to know the method of how to pull the file from their server
programatically.

I'm sure this is extremly easy, I just dont know where to start.

Thanks,

J
Feb 3 '06 #1
4 1145
The most simplistic way is to use the WebClient DownloadData method, wich
returns a byte array. YOu can then create a filestream with the appropriate
name and extension and write this to a PDF file.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"wa********@newsgroups.nospam" wrote:
Hello,

I have a client that is feeding PDF files to me. They do not want me to
link to their files since that can put a strain on their bandwidth. What
they asked I do is download the file and store it on my server.

My question is, how do I download a file based on a url at runtime?

In other words, I have an xml file from my client with hundreds of PDF file
urls. I want to write a program that parses out the XML file and
automatically downloads the PDF files and places them locally on my server.

How would this be done?

I dont need to know how to parse the XML file or add the files to my server.
I just need to know the method of how to pull the file from their server
programatically.

I'm sure this is extremly easy, I just dont know where to start.

Thanks,

J

Feb 3 '06 #2
DWS
Easy
dotnet 2.0 system.net.WebRequestMethods.File

Intermediate
dotnet 1.1 system.net.webrequest.

Download the 101 samples for vs 2003 and grab the how to send and receive
data example.
http://www.microsoft.com/downloads/d...ng=en#filelist

Good Luck
DWS
reply to the group or thread if you need more help on this.
"wa********@newsgroups.nospam" wrote:
Hello,

I have a client that is feeding PDF files to me. They do not want me to
link to their files since that can put a strain on their bandwidth. What
they asked I do is download the file and store it on my server.

My question is, how do I download a file based on a url at runtime?

In other words, I have an xml file from my client with hundreds of PDF file
urls. I want to write a program that parses out the XML file and
automatically downloads the PDF files and places them locally on my server.

How would this be done?

I dont need to know how to parse the XML file or add the files to my server.
I just need to know the method of how to pull the file from their server
programatically.

I'm sure this is extremly easy, I just dont know where to start.

Thanks,

J

Feb 3 '06 #3
Thanks to both of your responses. That helped me a bunch. I don't know
which one I am going to use but I think I will try the .net 2.0 way first.

J

<wa********@newsgroups.nospam> wrote in message
news:eW**************@TK2MSFTNGP09.phx.gbl...
Hello,

I have a client that is feeding PDF files to me. They do not want me to
link to their files since that can put a strain on their bandwidth. What
they asked I do is download the file and store it on my server.

My question is, how do I download a file based on a url at runtime?

In other words, I have an xml file from my client with hundreds of PDF
file urls. I want to write a program that parses out the XML file and
automatically downloads the PDF files and places them locally on my
server.

How would this be done?

I dont need to know how to parse the XML file or add the files to my
server. I just need to know the method of how to pull the file from their
server programatically.

I'm sure this is extremly easy, I just dont know where to start.

Thanks,

J

Feb 4 '06 #4
Hi J,

If the files you want to programmaticaly download are located through http
url, the .NET framework 1.1's network components are enough. One
improvement of .NET 2.0's webreuqest components is the FtpWebRequest which
can help handle Ftp protocol communications. And for normal http based
file download/upload, the webclient class(available in both 1.1 and 2.0) is
a simple and quick solution. Also, if you want to have more control on the
underlying http message, you can choose to use httpwebrequest class
directly. Here are some articles mentioned using those component to
download http base files:

#Uploading and Downloading Files
http://www.c-sharpcorner.com/Interne...esponseMDB.asp

#Download a Web Pages Contents and Save them to a File in VB.NET
http://www.freevbcode.com/ShowCode.asp?ID=2174

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Feb 6 '06 #5

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

Similar topics

7
by: MAK | last post by:
Hello everyone, I know how to add images and icons etc to dll file. What I would like to know is there is a way to add those icons on the forms during the run time from the dll or to reference it ...
1
by: David Fraser | last post by:
I used this when trying to retrieve the McMillan site. Others might find it useful... David #!/usr/bin/env python import urlparse import urllib2 import os
6
by: Sylvain Thenault | last post by:
Hi there ! I've some questions regarding pth files (which btw are undocumented in the python reference, is this intentional ?) I thought that I could use a .pth file to be able to import zope...
10
by: bj daniels | last post by:
I am trying to get the number of .jpg files in a given folder (to pick a random one). The folder is referenced by a url - how can I do this. I have tried the code below - but get an error that...
2
by: Rudy | last post by:
Hello all! I have a web application, that I can upload files to a folder from the web site. The file path is stored in SQL. I have a 73GB drive, external hooked into the web server. I can load up...
6
by: Julien | last post by:
Hello, I have some files located in a file server and managed by a SQL database from a web based interface using ASP + VBSCRIPT technology. I need to automatically copy those files to a web...
1
by: UJ | last post by:
I am doing development on a machine and everything was working fine. The name of the project was ECS to I made all my references as ~/ECS/... Worked great. Put it on the final server running...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
3
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
I've added a web deployment project and want to use the config section replacement but I'm obviously not understanding something. I have set up an alternate appSettings file,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...

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.