Arsip: ngarahin penyimpanan ke server

 
user image
more 14 years ago

lela

saya bikin program dimana foto inginnya disipen di server. Gimana caranya ngarahin ke servernya tehnik penyimpanan yang saya lakukan klo nga diarahkan ke server: procedure TForm1.SimpanFileDenah; var bmp_denah: TBitmap; jpg_denah: TJpegImage; scale_denah: Double; begin jpg_denah := TJpegImage.Create; try jpg_denah.Loadfromfile( namadenah.Caption); if jpg_denah.Height > jpg_denah.Width then scale_denah := 480/ jpg_denah.Height else scale_denah := 600 / jpg_denah.Width; bmp_denah := TBitmap.Create; try {Create thumbnail bitmap, keep pictures aspect ratio} bmp_denah.Width := Round( jpg_denah.Width scale_denah ); bmp_denah.Height:= Round( jpg_denah.Height scale_denah ); bmp_denah.Canvas.StretchDraw( bmp_denah.Canvas.Cliprect, jpg_denah ); {Draw thumbnail as control} Canvas.Draw( 200, 150, bmp_denah ); {Convert back to JPEG and save to file} jpg_denah.Assign( bmp_denah ); jpg_denah.SaveToFile(ChangeFileext( lpath.Caption+'\foto\denah'+banyakdenah.Caption,'.jpg')); namadenah.Caption:=lpath.Caption+'\foto\denah'+banyakdenah.Caption+'.jpg'; finally bmp_denah.free; end; finally jpg_denah.free; end; end; ket: lpath -> nama pathnya Makasih atas bantuannya.
user image
more 14 years ago

lela

klo penggunaan indyclient dan server tuh gimana sih lebih jelasnya ada yang tau nga????????????????
user image
more 14 years ago

EkoIndri

klo pengen simpan di server, mending simpan di database yang ditaruh di server aja mas dah sering dibahas koq untuk penyimpanan gambar menggunakan database. silahkan review thread2 sebelumnya
user image
more 14 years ago

lela

tolong mas, panggilnya lela jangan pake mas, atow lel, maksud ak gini lho, ak tuh pengen nyimpan file ke computer tertentu, tarolah host-nya 192.168.0.1, trus pada komputer itu aku taro ke path+namafile+'.jpg' nah, klo misalkan penyimpanannya ak gabung antara host kompnya dengan nama filenya (192.168.0.1+':'+path+namafile+'.jpg') , itu malah nga mau, saya pernah baca2 dikit indy, katanya indy component itu dapat melakukan client-server. cuman saya kurang paham?? Saya mohon banget bantuannya, untuk bantuannya , saya ucapkan banya terima kasih.
user image
more 14 years ago

ZeAL

Nope.. gak bisa kayak gitu... kalo mau pake client server, filenya harus dijadiin stream dulu.. gak bisa cuma sekedar path aja... Langkah yang simpel dan gak neko-neko yaitu bikin "Map Network Drive" di komputer lokal yang merajuk ke server.. tapi client harus punya akses tulis ke folder yang dishare tersebut... Jadi misalnya server punya folder "Foto" dan dishare dan diberi akses tulis, maka client cukup klik kanan folder tersebut di windows explorer dan pilih "Map Network Drive".. nanti tentukan nama drivenya, misalnya "Z:".. nanti program cukup langsung save ke 'Z:'+path+namafile+'.jpg' Kekurangannya si client punya akses langsung ke direktori foto.. kalo mo ngirim via TCP/IP, bisa liat di demo chat gue : zeal.delphi-id.org/demo/chat.rar
user image
more 14 years ago

tox2wow

kalo mo ngirim via TCP/IP, bisa liat di demo chat gue : zeal.delphi-id.org/demo/chat.rar
Horeeeee .... hidup ZeAL .... Raja Chating ... wakakakakakak .... :p ....
user image
more 14 years ago

doditali

aku sich pake komponen idtrivialftp dan idtrivialftpserver , itu pun source juga saya cari di om google saya sudah coba sourcenya utk upload file ke server source :

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdUDPServer, IdTrivialFTPServer, IdBaseComponent,
  IdComponent, IdUDPBase, IdUDPClient, IdTrivialFTP;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    IdTrivialFTP1: TIdTrivialFTP;
    IdTrivialFTPServer1: TIdTrivialFTPServer;
    procedure FormCreate(Sender: TObject);
    procedure IdTrivialFTPServer1ReadFile(Sender: TObject;
      var FileName: String; const PeerInfo: TPeerInfo;
      var GrantAccess: Boolean; var AStream: TStream;
      var FreeStreamOnComplete: Boolean);
    procedure IdTrivialFTPServer1WriteFile(Sender: TObject;
      var FileName: String; const PeerInfo: TPeerInfo;
      var GrantAccess: Boolean; var AStream: TStream;
      var FreeStreamOnComplete: Boolean);
    procedure IdTrivialFTPServer1TransferComplete(Sender: TObject;
      const Success: Boolean; const PeerInfo: TPeerInfo; AStream: TStream;
      const WriteOperation: Boolean);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
      TFTPPath: string;
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
  IdTrivialFTPServer1.ThreadedEvent := True;
  IdTrivialFTPServer1.Active := True;
  { Set the path to where the files will be stored/retreived }
  TFTPPath := IncludeTrailingPathDelimiter('C:');  {file yg dikirim akan disimpan di drectory c:\}
end;
procedure TForm1.IdTrivialFTPServer1ReadFile(Sender: TObject;
  var FileName: String; const PeerInfo: TPeerInfo;
  var GrantAccess: Boolean; var AStream: TStream;
  var FreeStreamOnComplete: Boolean);
var
  FS: TFileStream;
begin
  FreeStreamOnComplete := True;
  try
   
    while Pos('/', Filename) <> 0 do
      Filename[Pos('/', Filename)] := ' ';
    
    Filename := ExtractFileName(Filename);
    { Cek jika sudah filenya diserver }
    if FileExists(TFTPPath + Filename) then
    begin
         FS := TFileStream.Create(TFTPPath + Filename,
        fmOpenRead or fmShareDenyWrite);
      AStream := FS;
      GrantAccess := True;
    end
    else
    begin
      GrantAccess := False;
    end;
  except
    { Error }
    GrantAccess := False;
    if Assigned(FS) then
      FreeAndNil(FS);
  end;
end;
procedure TForm1.IdTrivialFTPServer1WriteFile(Sender: TObject;
  var FileName: String; const PeerInfo: TPeerInfo;
  var GrantAccess: Boolean; var AStream: TStream;
  var FreeStreamOnComplete: Boolean);
var
  FS: TFileStream;
begin
  try
    while Pos('/', Filename) <> 0 do
      Filename[Pos('/', Filename)] := ' ';
      Filename := ExtractFileName(Filename);
    FS := TFileStream.Create(TFTPPath + Filename,
      fmCreate or fmShareExclusive)   AStream := FS;
    FreeStreamOnComplete := True;
    GrantAccess := True;
  except
    GrantAccess := False;
    if Assigned(FS) then
      FreeAndNil(FS);
  end;
end;
procedure TForm1.IdTrivialFTPServer1TransferComplete(Sender: TObject;
  const Success: Boolean; const PeerInfo: TPeerInfo; AStream: TStream;
  const WriteOperation: Boolean);
begin
  try
    { tutup FileStream }
    if Assigned(AStream) then
      FreeAndNil(AStream);
  except
  end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  { kirim Stream ke TFTP Server }
  IdTrivialFTP1.Put('c:\my documents\logo.jpg', 'logo_logo.jpg');
  //file yg dikirm dari directory c:\my documents\logo.jpg ke directorty server c:\ dgn nama file logo_logo.jpg
  ShowMessage('sukses terkirim ke server ');
end;
end.
semoga membantu
user image
more 14 years ago

lela

aku udah nyoba yg IdTrivialFTP, Gimana sih cara mastiin Hostnya, maksudnya aku nyobain program di komp B tapi, tetep fotonya aku pengen nyimpen di A, mohon bantuannya mas. rambutku udah kriting nih, kebanyakan makan Mie
user image
more 14 years ago

doditali

coba isikan di properti host idtrivialftp !!!! jadi misalnya kalo no ip servernya 192.168.0.1 isikan properti host idtrivialftp = 192.168.0.1 idtrivialftp1.host :='192.168.0.1';
user image
more 14 years ago

lela

mas, boleh nambah nga?????????????? boleh aja ya... gimana filenya format jpg, makasih
more ...
  • Pages:
  • 1
  • 2
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com