Page 1 of 1

SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 10:14 am
by mauz
hi, i did try SendFTPFile() to send a file about 5 kb on server, the file is arrived but on server result 0 byte..

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 10:37 am
by Kiffi
That is a pity

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 10:55 am
by mauz
maybe a bug?,beyond a sin...

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 11:04 am
by BarryG
We don't know if it's a bug without seeing the code you used.

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 11:10 am
by ChrisR
Share a code
Otherwise you can try with this batch

Code: Select all

@Echo off
Echo Open 127.0.0.1      >Ftp.txt
Echo User               >>Ftp.txt
Echo Password           >>Ftp.txt
Echo Binary             >>Ftp.txt
Echo Cd C:\$Recycle.Bin >>Ftp.txt
Echo Put SPAM.txt       >>Ftp.txt
Echo Bye                >>Ftp.txt
Ftp -s:Ftp.txt

Edit: Sorry if the batch is inappropriate but a new user should have a more precise post, with a code shared, on his request.
Otherwise we all think it's a spammer, there are many of them nowadays and it would be good to improve the captcha.

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 11:48 am
by mauz
Is the ftp example in help, i used it on Altervista server sendin an image.

Code: Select all

If OpenFTP(0, "server.altervista.org", "test", "test", 0)

  Result = SendFTPFile(0, OpenFileRequester("Choose a file to send", "", "*.*", 0), "image.ico", 1)
  
  Repeat
    Debug FTPProgress(0)
    Delay(300)
  Until FTPProgress(0) = #PB_FTP_Finished Or FTPProgress(0) =  #PB_FTP_Error

  Debug "finished"
  
Else
  MessageRequester("Error", "Can't connect to the FTP server")
EndIf

Re: SendFTPFile() file 0 byte

Posted: Wed Nov 09, 2022 2:20 pm
by ChrisR
Try this ftp batch to display server responses, errors (change "d:\Icon.ico")

Code: Select all

@Echo Off
Echo Open server.altervista.org>%Temp%\Ftp.txt
Echo test>>%Temp%\Ftp.txt
Echo test>>%Temp%\Ftp.txt           
Echo Binary>>%Temp%\Ftp.txt
Echo Put "d:\Icon.ico" Image.ico>>%Temp%\Ftp.txt
Echo Bye>>%Temp%\Ftp.txt
Ftp -s:%Temp%\Ftp.txt
Del /f /q %Temp%\Ftp.txt
Pause

Re: SendFTPFile() file 0 byte

Posted: Sun Nov 13, 2022 8:43 am
by mauz
how can force ftp send file in UTF-8?

Re: SendFTPFile() file 0 byte

Posted: Sun Nov 13, 2022 10:57 am
by infratec
In general the transfer type of ftp should be set to binary.
No modification of the file coding is needed.

More informations about it:
https://www.jscape.com/blog/ftp-binary- ... rupt-files

I think SendFTPFile() uses binary mode.
You can check this via wireshark.

Re: SendFTPFile() file 0 byte

Posted: Sun Nov 13, 2022 11:17 am
by infratec
Or you can use libcurl.pbi with external dll.
Then you can use:

https://curl.se/libcurl/c/CURLOPT_TRANSFERTEXT.html

viewtopic.php?p=591235

Re: SendFTPFile() file 0 byte

Posted: Mon Nov 14, 2022 3:32 am
by otis
mauz wrote: Wed Nov 09, 2022 10:14 am hi, i did try SendFTPFile() to send a file about 5 kb on server, the file is arrived but on server result 0 byte.. among us wordle
The problem is that SendFTPFile() does not support sending more than 5 kb. This is because the server can only handle a maximum of 5 kb per transfer. So if you try to send more than 5 kb, the server will return an error.
If you want to send more than 5 kb, you need to use a different method. One way is to use the FTP protocol. Another way is to use a third-party FTP client.
When using a third-party FTP client, you need to make sure that it supports the FTP protocol. If it does, then you can send more than 5 kb with no problem.

Re: SendFTPFile() file 0 byte

Posted: Mon Nov 14, 2022 8:19 am
by BarryG
otis wrote: Mon Nov 14, 2022 3:32 am
mauz wrote: Wed Nov 09, 2022 10:14 am hi, i did try SendFTPFile() to send a file about 5 kb on server, the file is arrived but on server result 0 byte.. among us wordle
The problem is that SendFTPFile() does not support sending more than 5 kb.
This bot reply is actually really clever, I must admit. Post reported.

Re: SendFTPFile() file 0 byte

Posted: Mon Nov 14, 2022 8:28 am
by Oso
BarryG wrote: Mon Nov 14, 2022 8:19 am This bot reply is actually really clever, I must admit. Post reported.
There are two bots then, I assume? Rather scary. :shock:

Re: SendFTPFile() file 0 byte

Posted: Mon Nov 14, 2022 8:28 am
by idle
BarryG wrote: Mon Nov 14, 2022 8:19 am
otis wrote: Mon Nov 14, 2022 3:32 am
mauz wrote: Wed Nov 09, 2022 10:14 am hi, i did try SendFTPFile() to send a file about 5 kb on server, the file is arrived but on server result 0 byte.. among us wordle
The problem is that SendFTPFile() does not support sending more than 5 kb.
This bot reply is actually really clever, I must admit. Post reported.
yes I think its a bot using a content generating AI like gp3. Is sounds plausible but given the context why would a new user answer a question like that.

Re: SendFTPFile() file 0 byte

Posted: Mon Nov 14, 2022 9:04 am
by Oso
idle wrote: Mon Nov 14, 2022 8:28 am yes I think its a bot using a content generating AI like gp3. Is sounds plausible but given the context why would a new user answer a question like that.
I guess the second bot signed-up in order to post replies to the first bot, in an attempt to make the post plausible. I'm beginning to think that it's a person.