SendFTPFile() file 0 byte

Just starting out? Need help? Post your questions and find answers here.
User avatar
mauz
New User
New User
Posts: 5
Joined: Fri Nov 04, 2022 10:00 am

SendFTPFile() file 0 byte

Post 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..
User avatar
Kiffi
Addict
Addict
Posts: 1493
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: SendFTPFile() file 0 byte

Post by Kiffi »

That is a pity
Hygge
User avatar
mauz
New User
New User
Posts: 5
Joined: Fri Nov 04, 2022 10:00 am

Re: SendFTPFile() file 0 byte

Post by mauz »

maybe a bug?,beyond a sin...
BarryG
Addict
Addict
Posts: 4163
Joined: Thu Apr 18, 2019 8:17 am

Re: SendFTPFile() file 0 byte

Post by BarryG »

We don't know if it's a bug without seeing the code you used.
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: SendFTPFile() file 0 byte

Post 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.
Last edited by ChrisR on Wed Nov 09, 2022 12:00 pm, edited 2 times in total.
User avatar
mauz
New User
New User
Posts: 5
Joined: Fri Nov 04, 2022 10:00 am

Re: SendFTPFile() file 0 byte

Post 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
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: SendFTPFile() file 0 byte

Post 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
User avatar
mauz
New User
New User
Posts: 5
Joined: Fri Nov 04, 2022 10:00 am

Re: SendFTPFile() file 0 byte

Post by mauz »

how can force ftp send file in UTF-8?
infratec
Always Here
Always Here
Posts: 7604
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: SendFTPFile() file 0 byte

Post 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.
infratec
Always Here
Always Here
Posts: 7604
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: SendFTPFile() file 0 byte

Post 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
otis
New User
New User
Posts: 1
Joined: Mon Nov 14, 2022 3:09 am

Re: SendFTPFile() file 0 byte

Post 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.
BarryG
Addict
Addict
Posts: 4163
Joined: Thu Apr 18, 2019 8:17 am

Re: SendFTPFile() file 0 byte

Post 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.
Oso
Enthusiast
Enthusiast
Posts: 595
Joined: Wed Jul 20, 2022 10:09 am

Re: SendFTPFile() file 0 byte

Post 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:
User avatar
idle
Always Here
Always Here
Posts: 5884
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: SendFTPFile() file 0 byte

Post 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.
Oso
Enthusiast
Enthusiast
Posts: 595
Joined: Wed Jul 20, 2022 10:09 am

Re: SendFTPFile() file 0 byte

Post 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.
Post Reply