Ver Mensaje Individual
  #3  
Antiguo 22-03-2009
c0lo c0lo is offline
Miembro
 
Registrado: ago 2008
Posts: 18
Reputación: 0
c0lo Va por buen camino
Bueno usar una conexion FTP para un programa publico no es conveniente ya que si snifeas los archivos se mostraran tus datos, como hosting, user and pass. La mejor solucion es usar un FTPS.

Pero hay una solucion mas sencilla que seria "Uploading File Using Delphi To A Php Upload Script"

Cita:
You can do this using Indy that comes with Delphi. It involves two things. TIdHTTP and TIdMultipartFormDataStream.

Add IdMultipartFormData to your uses clause. Drop TIdHTTP (which is in Indy Clients tab of Component Palette ) on to your form. Set whatever properties of TIdHTTP you want. Now if you were wanting the file to be uploaded after a button has been clicked then put this in the event handler you assigned for the buttons OnClick event.

Código:
procedure TFormClassNameHere.EventHandlerNameHere( Sender : TObject )
var
  Stream            : TIdMultipartFormDataStream;
begin
  Stream := TIdMultipartFormDataStream.Create;
  try
    Stream.AddFile( 'form_field_name_here', 'filename_here', 'content-type_here' );
    IdHTTP1.Post( 'url_here', Stream );
  finally
    Stream.Free;
  end;
end;
Esta seria la solucion mas practica y segura en un sentido, ya que tendrias que proteger tu aplicacion de tal forma no sepan como subes un archivo a tu ftp, ya que podrian meter una shell o algo similar y poder tener el control de tu ftp.. mediante algun tipo de inyeccion.
Responder Con Cita