Solved

Recive filestream to local filesystem.

Posted on 2004-04-11
4
513 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

615 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