File uploads successfully however it is 0 bytes

27,185

Solution 1

There are three main possibilities attached to that error code. You either don't have permission to upload to that directory, the disk on the server is full, or uploading the file would exceed your user's disk quota.

Ftp 4xx error codes are "Transient Negative Completion reply" codes. In other words, these error codes are returned when the server fails to do something. Specifically, error code 451 indicates that the server could not write to a file.

If it is true that you are able to create files of zero size in the remote directory, then the possibility of a permission error is most likely ruled out.

If you can contact the server's administrator, you should be able to determine the exact problem.

Solution 2

Sounds like a full disk issue. If you have access to the FTP server you can confirm if the disk is full with the following command:

$ df
Filesystem  1K-blocks  Used      Available  Use%  Mounted on
/dev/hda3   76773444   72816084  0          100%  /
/dev/hda1   101086     16327     79540      18%   /boot
/dev/shm    501628     0         501628     0%    /dev/shm

This shows that device /dev/hda3 is full. Additionally you can check in the FTP server's log file:

$ less /var/log/messages

And then search for FTP to find any messages from the server with errors about not being able to write to the disk.

Share:
27,185

Related videos on Youtube

osoclever
Author by

osoclever

Updated on September 18, 2022

Comments

  • osoclever
    osoclever over 1 year

    I have an interesting problem where I have the ability to upload files, change permissions, download files using FTP on Cent OS. However, the interesting and annoying part is that the files are completely blank (0 bytes) when they get uploaded.

    What might be the trouble here?

    Here is the log from the client (FileZilla):

    Status: Starting upload of C:\gettweetmodel_dev.php
    Status: Retrieving directory listing...
    Command:    TYPE I
    Response:   200 Switching to Binary mode.
    Command:    PASV
    Response:   227 Entering Passive Mode.
    Command:    LIST -a
    Response:   150 Here comes the directory listing.
    Response:   226 Directory send OK.
    Command:    TYPE A
    Response:   200 Switching to ASCII mode.
    Command:    PASV
    Response:   227 Entering Passive Mode
    Command:    STOR gettweetmodel_dev.php
    Response:   150 Ok to send data.
    Response:   451 Failure writing to local file.
    
    • osoclever
      osoclever almost 11 years
      Here's a log I've gotten from Filezilla: Status: Starting upload of C:\gettweetmodel_dev.php Status: Retrieving directory listing... Command: TYPE I Response: 200 Switching to Binary mode. Command: PASV Response: 227 Entering Passive Mode. Command: LIST -a Response: 150 Here comes the directory listing. Response: 226 Directory send OK. Command: TYPE A Response: 200 Switching to ASCII mode. Command: PASV Response: 227 Entering Passive Mode Command: STOR gettweetmodel_dev.php Response: 150 Ok to send data. Response: 451 Failure writing to local file. Error: File transfer failed
    • Admin
      Admin almost 11 years
      Mind adding that to your question? Formatting gets messed up in comments.
    • osoclever
      osoclever almost 11 years
      That appears to be it. It didn't even occur to me that it could be the problem.
  • osoclever
    osoclever almost 11 years
    I ran out of hard drive space due to an obnoxious mysql table with millions of records.
  • osoclever
    osoclever almost 11 years
    Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 19609276 18812812 0 100% / tmpfs 250512 0 250512 0% /dev/shm
  • slm
    slm almost 11 years
    @osoclever - yup it's happened to everyone here. Glad you solved it.
  • Revious
    Revious over 7 years
    it's none of these.. what can I check else? I am the sysadmin :(
  • Jeff Schaller
    Jeff Schaller over 6 years
    as was mentioned and mentioned and mentioned