Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

gUiTaR_mAn

Upload De Arquivos

Recommended Posts

olá..

 

estou fazendo um sistema em delphi e preciso fazer o upload de um arquivo no servidor web.

o servidor é a kinghost mas toda vez que tento me retorna uma mensagem dizendo " socket is not ready for writing", sendo que no servidor esta tudo configurado certinho para escrita..

 

estou usando o componente TChilkatFtp2 na minha procedure

 

meu code segue abaixo:

procedure TForm1.Button4Click(Sender: TObject);
var
ftp: TChilkatFtp2;
success: Integer;
localFilename: String;
remoteFilename: String;

begin
ftp := TChilkatFtp2.Create(Self);

//  Any string unlocks the component for the 1st 30-days.
success := ftp.UnlockComponent('Anything for 30-day trial');
if (success <> 1) then
  begin
	ShowMessage(ftp.LastErrorText);

  end;

ftp.Hostname := 'ftp.cinefotomary.com.br';
ftp.Username := '******';
ftp.Password := '*****';

//  The default data transfer mode is "Active" as opposed to "Passive".

//  Connect and login to the FTP server.
success := ftp.Connect();
if (success <> 1) then
  begin
	ShowMessage(ftp.LastErrorText);
	abort;
  end;

//  Change to the remote directory where the file will be uploaded.
success := ftp.ChangeRemoteDir('www');
if (success <> 1) then
  begin
	ShowMessage(ftp.LastErrorText);
	abort;
  end;

//  Upload a file.
localFilename := 'c:\teste.jpeg';
remoteFilename := 'teste.jpeg';

success := ftp.PutFile(localFilename,remoteFilename);
if (success <> 1) then
  begin
	ShowMessage(ftp.LastErrorText);
	abort;
  end;

ftp.Disconnect();

ShowMessage('File Uploaded!');
end;

alguém pode me dar um help?

obrigado..

Compartilhar este post


Link para o post
Compartilhar em outros sites

Porque não usa o Indy???

 

Ele possui diversos exemplos com FTP... eu até mesmo fiz um atualizador de sistemas e um sistema de ftp certa vez...

 

Qual versão do delphi está utilizando???

 

 

Abraço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.