1

tl;dr, is there any reason that one file would fail to transfer completely over ftp, while every other file uploaded in the exact same way works fine?

Every week, I use python's ftplib to update my website – usually this consists of transferring around 30-31 files total - 4 that overwrite existing files, and the rest that are completely new. For basically all of these files, my code looks like:

myFile = open('[fileURL]', 'rb')
ftp.storbinary(cmd='STOR [fileURLonServer]', fp=myFile)
myFile.close()

This works completely fine for almost all of my files. Except for one: the top-level index.html file. This file is usually around 7.8-8.1 kb in size, depending on its contents from week to week. It seems to be the case that only the first 4096 bytes of the file are transferred to the server – I have to manually go in and upload the full version of the index every week. Why is it doing this, and how can I get it to stop? Is there some metadata in the file that could be causing the problem?

StackOverflow recommended me this question which doesn't solve my problem – I'm already using the rb mode for opening every file I'm trying to transfer, and each one except this one is working perfectly fine.

Green Cloak Guy
  • 23,793
  • 4
  • 33
  • 53
  • 1
    have you considered `scp` or `rsync` for that matter, I figured since you'd be using ssh anyway this would come "at not extra cost" – zython Apr 02 '18 at 17:49
  • 2
    If this fails: do you upload the file manually by also using the FTP protocol or are you using things like SFTP, SCP,... then? Because, some routers claim to have an IDS which might cause such effects due to false positives, see [Can't upload (FTP) PHP file containing base64_decode()?](https://stackoverflow.com/a/35433790/3081018) – Steffen Ullrich Apr 02 '18 at 17:52
  • @SteffenUllrich I upload it manually with FTP using a client. – Green Cloak Guy Apr 02 '18 at 21:16
  • @zython my webhost doesn't support SSH, otherwise I'd be using that instead – Green Cloak Guy Apr 02 '18 at 21:16
  • @GreenCloakGuy: do you upload it manually using the same client (i.e. Python)? If not, have you've tried and are you able to reproduce the problem when just uploading this single file? – Steffen Ullrich Apr 03 '18 at 02:11
  • @SteffenUllrich I upload it manually using a different client (Cyberduck; it has a GUI). I just tried writing a different python program to just upload the index page, and it doesn't seem to have any problem. – Green Cloak Guy Apr 03 '18 at 17:18

0 Answers0