shekou
asked on
How to combine a splited files?
Whether is it possible to split a big files into small
parts first, then transfer those small parts to a webserver and combine them together?
Thanks
Shekou
parts first, then transfer those small parts to a webserver and combine them together?
Thanks
Shekou
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Listening.....
ASKER
I know it is easy to combine the file in c:\, what I am
asking is whether is it possible to concatenate files in a
webserver ( or ftp server) such as under ftp://ftp.mydrive.com/
Thanks
Shekou
asking is whether is it possible to concatenate files in a
webserver ( or ftp server) such as under ftp://ftp.mydrive.com/
Thanks
Shekou
even that my sample works with streams,
you can download the fragments, combine it
and upload the whole file
you can download the fragments, combine it
and upload the whole file
ASKER
Still some misunderstanding, I am NOT mean upload a whole file, I mean upload splitted parts of file to ftp://ftp.mydrive.com/ then combine them together from there. How to do that?
Thanks
James
Thanks
James
this must do the ftp-server, i guess,
with an ftp-server os depending script
with an ftp-server os depending script
a simple sample
unit splitfiles_u;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
Edit1: TEdit;
SaveDialog1: TSaveDialog;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//Splitting Files
procedure TForm1.Button1Click(Sender
var
i, WantedFragSize, RealToWrite : Integer;
InStream, OutStream : TFileStream;
S : String;
begin
if Opendialog1.Execute then
begin
SaveDialog1.Title := 'Select Dir and input FilePrefix without Suffix';
If SaveDialog1.Execute then
begin
WantedFragSize := StrtoInt(Edit1.Text); //Wanted SplitSize
i := 0;
InStream := TFileStream.Create(OpenDia
try
while (InStream.Position < InStream.Size) do
Begin
s := IntToStr(I); //Building numeric suffix
while Length(s) < 3 do s := '0'+s;
s := '.'+s;
If InStream.Size - InStream.Position < WantedFragSize then
RealToWrite := InStream.Size - InStream.Position
else
RealToWrite := WantedFragSize;
OutStream := TFileStream.Create(SaveDia
try
OutStream.CopyFrom(InStrea
Inc(i);
finally
OutStream.Free;
end;
end;
Finally
InStream.Free;
end;
end;
end;
end;
//concanating files
procedure TForm1.Button2Click(Sender
var
i : Integer;
InStream, OutStream : TFileStream;
SourcePath, FragName, S : String;
begin
Opendialog1.Title := 'Select any Fragmented File';
if Opendialog1.Execute then
begin
SourcePath := ExtractFilePath(Opendialog
FragName := ExtractFileName(Opendialog
SaveDialog1.Title := 'Select Dir and input the FileName with Suffix';
If SaveDialog1.Execute then
begin
i := 0;
s := IntToStr(I);
while Length(s) < 3 do s := '0'+s;
s := '.'+s;
FragName := ChangeFileExt(FragName, s);
If FileExists(SourcePath+Frag
begin
OutStream := TFileStream.Create(Savedia
try
While FileExists(SourcePath+Frag
Begin
InStream := TFileStream.Create(SourceP
try
OutStream.CopyFrom(InStrea
Inc(i);
s := IntToStr(I);
while Length(s) < 3 do s := '0'+s;
s := '.'+s;
FragName := ChangeFileExt(FragName, s);
finally
InStream.Free;
end;
end;
finally
OutStream.Free;
end;
end;
end;
end;
end;
end.
meikl ;-)