Solved

Recive filestream to local filesystem.

Posted on 2004-04-11
4
512 Views
Last Modified: 2010-04-05
Hi there folks

Im trying to do a FTP server for recive  files from a FTP client via a filestream. Im trying to do the ftp server with the indy component.  FTPServer.

In the demo they just show how to retrive a file. and i know nothing of how to use tfilestream
It would be nice if u show me how to recive a new file and how to appaend if the file is not completly uploaded yet.

plz help me

Regards

J
0
Comment
Question by:jontebgood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 10802746
Hi

// upload file from client and store (or append) in server

procedure TForm1.IdFTPServer1StoreFile(ASender: TIdFTPServerThread;
  const AFileName: String; AAppend: Boolean; var VStream: TStream);
begin
  ListBox1.Items.Add('Store: ' + ASender.Username + ' - ' + AFileName);
  if AAppend and FileExists(AFileName) then
    begin
    VStream := TFileStream.Create(AFileName,fmOpenReadWrite);
    end
  else
    VStream := TFileStream.Create(AFileName,fmCreate);
end;


// download file from server to client
procedure TForm1.IdFTPServer1RetrieveFile(ASender: TIdFTPServerThread;
  const AFileName: String; var VStream: TStream);
begin
  ListBox1.Items.Add('Retrieve: ' + ASender.Username + ' - ' + AFileName);
  VStream := TFileStream.Create(AFileName,fmOpenRead + fmShareDenyWrite);
end;
0
 

Author Comment

by:jontebgood
ID: 10803732
Thanks! in the append part... U just check if the file exsists.... if it does but someone have upload it so it is complete`? then it seems to me that the file will be corrupt right?

Regards
0
 
LVL 17

Accepted Solution

by:
mokule earned 500 total points
ID: 10804345
Yes.
There is no information on server side at what position append. It is always appended at the end of currently stored file. It is the responsibility of client to send chunks in proper order.
0
 

Author Comment

by:jontebgood
ID: 10804745
Thanks...

Best regards

J
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question