473,395 Members | 1,348 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,395 software developers and data experts.

How to Append to a File via FTP

Here is my problem: I need to append a string to a file every time the
user downloads this file. The string is different for every user. I
would like to append the string to the file via ftp. But I am not sure
how I can do this, I've never written an FTP client. Which class can I
use to do this? Is it possible to append to a file that already is in
an FTP server? Will the FTPWebRequest class work?
Thanks in advance for your ideas,
Simone

Apr 13 '06 #1
5 5926
* Simone M wrote:
Here is my problem: I need to append a string to a file every time the
user downloads this file. The string is different for every user. I
would like to append the string to the file via ftp. But I am not sure
how I can do this, I've never written an FTP client. Which class can I
use to do this? Is it possible to append to a file that already is in
an FTP server? Will the FTPWebRequest class work?


To append to a file you'd have to retrieve the file, append your data,
and upload the altered file. This is how FTP works, it's designed for
transfering files it's not a fileserving application with normal file
access semantics.

Mr Flibble
Apr 13 '06 #2
I'm not following you. It *sounds* like you are working from the server end,
and that when an FTP client requests a file, it is appended to prior to
attaching it to the response stream. If so, you don't need to create an FTP
client, but an FTP server. And the server app would not need FTP to append
to the file, which is on the server. It would append to it prior to
returning it. OTOH, if you are working with an FTP client that downloads
files, and youy want to append to the downloaded file, there is also no need
to do it via FTP. The client app can append to the downloaded file prior to
returning it or saving it.

Perhaps you should outline the actual requirements for your app, rather than
the methodology you think you need to employ to satisfy those requirements.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Simone M" <si************@hotmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
Here is my problem: I need to append a string to a file every time the
user downloads this file. The string is different for every user. I
would like to append the string to the file via ftp. But I am not sure
how I can do this, I've never written an FTP client. Which class can I
use to do this? Is it possible to append to a file that already is in
an FTP server? Will the FTPWebRequest class work?
Thanks in advance for your ideas,
Simone

Apr 13 '06 #3
You got my point. But I was looking to save on bandwidth, since it's a
large file, and having to retrieve the file costs bandwith. I wish I
could just do some cutting/appending operations on the file, but I
guess it's not possible without having to retrieve it ???
Thanks,
Simone

Apr 13 '06 #4
Thanks Kevin.
You have lead me to the right direction. I was thinking wrong. I don't
need to use FTP. I could append the data to the file on the server
before the user downloads it since I have acess to the file on the
server. I guess this is a common problem.
Just a question: What do you mean by Response Stream?
Can't I accomplish this by just using a FileStream?

Apr 13 '06 #5
Hi Simone,

If you want to append to the file before returning it, you're going to have
to handle the FTP Request. That means that you need to write an FTP server
that will receive the RETR command, fetch the file specified, append to it,
and then send the appended file to the client.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Simone M" <si************@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Thanks Kevin.
You have lead me to the right direction. I was thinking wrong. I don't
need to use FTP. I could append the data to the file on the server
before the user downloads it since I have acess to the file on the
server. I guess this is a common problem.
Just a question: What do you mean by Response Stream?
Can't I accomplish this by just using a FileStream?

Apr 13 '06 #6

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

Similar topics

3
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
4
by: David Beck | last post by:
I donwnload some files for processing every day that have unwanted characters in them. In VB6 I use the InputB to read in the text and the StrConv. vLinesFromFile =...
5
by: Mark | last post by:
Can I bind datagrid to an xml string (not to file)? For example, the result of transformation?
1
by: BW | last post by:
I am creating an upload/download function for an extranet site. Files will be uploaded to directory based upon the users login and associated project. The function works as long as I use "c:\Temp"...
4
by: Brian Parker | last post by:
Here's a snippet of code I have: ============================================== DataSet ds = new DataSet(); string strXMLFileName = Path.GetTempFileName(); StreamWriter sw = File.AppendText(...
29
by: jaysherby | last post by:
I'm new at Python and I need a little advice. Part of the script I'm trying to write needs to be aware of all the files of a certain extension in the script's path and all sub-directories. Can...
9
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to open a text file and format it into a specific line and then apply color to a specific location of the text and then display it in a RichTextBox after all of this is done. I can do all...
18
by: dainova | last post by:
Hi, I need to append a contents of the temp file to another output file, tried copy, but it doesn't work. I can't directly print into the output file as I need to check contents of temp first. I...
2
by: sajidali | last post by:
i am trying to append a text file using c#. when i executes my application i writes to the text file using more then one functions. i want to append file only during execution of programe. next time...
17
by: gayathrib1 | last post by:
i want to append a file(say g1) and add info frm temp file (say g2) .... the info frm g2 must be added at a paticular line of the file g1 say frm third line .... can anyone help me in this....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.