File corruption during ftp transfer ASCII vs. BINARY Updated on August 16, 2021 by InMotion Hosting Contributor 1 Minutes, 19 Seconds to Read Occasionally, issues occur with files becoming corrupt when uploading through FTP. When viewing the corrupted file through the browser, the following error will be thrown. “This image can not be displayed because it contains errors“ This is typically caused by uploading files through FTP as ASCII file transfer type. The “ASCII transfer type” will transfer the files as regular text files. The “Binary transfer type” will transfer the data in binary mode which handles the files as binary data instead of text data. Setting your FTP client to Binary will prevent your files from becoming corrupted through ftp transit. Please see the following on how to switch your FTP program to Binary. It’s also been brought to our attention that another possible cause of file corruption during FTP transfers, could be from your local firewall. Please also check for any updates to your firewall software, and possibly restart your router as well, if switching your FTP client settings to binary doesn’t work. Changing your ftp program to binary transfer You can change the transfer type in your ftp program to Binary. All FTP programs should have this functionality. The following steps will demonstrate how to change the transfer type from ASCII to Binary in Filezilla. Open your Filezilla ftp program. Select “Edit” and click “Settings“ from the drop Box. In the “Select page:” box, under “Transfers“, click “File Types“. In the “Default transfer type” section, select the “Binary” radio button. Click OK. Now when you connect to your server with ftp, files will be treated as Binary files. This should prevent the files from becoming corrupted. Share this Article Related Articles FTP Basics for Dedicated Servers FTP Error – 421 Too Many Connections Connect to SFTP for Shared Hosting Accounts Using FileZilla Getting Started Guide: FTP Configuring your site in WS_FTP How to Setup FTP with FileZilla Easily Upload Content to Your Hosting Via FTP Connecting with SCP and SFTP How to FTP with Internet Explorer 7/8 Add a FTP site to your Windows favorites
Hello, I have a problem with files uploading via FTP to my Server. Searched many forums, but didn’t find any solution. I’ve got a case with the ftp server.The files are being uploaded once in 8 minutes and then deleted in 1 minute, so we cannot access them when needed during work. I’ve read many forums saying that you should check the path; or the firewall, or the format, but nothing. Also, the format we need is txt,not binary. I would really appreciate your help!
Sorry for the problem with uploading files to your FTP server. If there are error or problems when you upload, then you should see them in your log (in the FTP client). The error messages there will help you to determine what’s causing the problem. FTP settings for my FTP client (I use FileZilla) are set to AUTO for file type – I let the client determine how it needs to send. The other choices are ASCII or Binary. Typically, the setting for accepting these transfer types are set at the server. I would double-check to make sure that your FTP client is connecting properly. Then, I would also double-check to make sure that your destination is not full (in terms of disk space). If you continue to have problems, then you should contact your hosting service as they will have access to determine why your FTP transfers are not working properly.
The size of the file gets compressed automatically and corrupted when uploaded via FileZilla. I’ve tried changing the File Type to ‘Binary’ in the settings. It is not rectified. Is there a way we can resolve this issue? Please help.
Hello, Sorry for the problem with the file being corrupted. The file itself is what needs to be compressed. My suggestion is that you use an application on your computer to compress the file FIRST, then upload it. Once you have compressed, you can also uncompress it and then check the file’s integrity.
Hi, I am using WinSCP to transfer file from one server to another server. But when the file is transfered and processed some of file data get missed to update in database. Can you help me out in this? Thanks, Soniya
Hello Soniya, Sorry for the issue with your file data. This doesn’t sound like an issue with the WinSCP program, but something file related. Double-check your logs from WinSCP to see if an error occurred during transfer. If nothing happened, you can try a different FTP client like Filezilla to make sure it’s not an FTP client issue. What size is the database file? If it’s larger than 50 MB, then you will need to submit a support ticket to have the file imported into your database. I hope that helps to answer your question! If you require further assistance, please let us know! Regards, Arnel C.
Hi, I face similar problem. I could transfer the file in Binary Mode. Btw, the file contain Mixed characters of Greek and English. Once the file is receive, how we need to decode the file from Binary. Because, the data look junk in the Linux server where I send this file.
Hello Vinoth, Thank you for contacting us. Can you provide a link to the site for testing? Best Regards, John-Paul
Hi John, Please find my script below. TODAY=`date +%Y%m%d` SCRIPT_CONFIG=~/script-config LOGARCHIVE=/logArchive ROTATE_LOG=$LOGARCHIVE/rotate.log for SERVER in `cat $SCRIPT_CONFIG/log-rotate.properties`;do echo SERVERNAME=`echo $SERVER | awk -F ‘|’ ‘{ print $1 }’` DOMAIN=`echo $SERVER | awk -F ‘|’ ‘{ print $2 }’` RMTLOGFILE=`echo $SERVER | awk -F ‘|’ ‘{ print $3 }’` LOGFILE=`echo $SERVER | awk -F ‘|’ ‘{ print $3 }’` if [ `ls $LOGARCHIVE/$SERVERNAME/$DOMAIN/ | grep $LOGFILE.$TODAY | wc -l` > 1 ];then NUMFILES=`ls $LOGARCHIVE/$SERVERNAME/$DOMAIN/ | grep “$LOGFILE.$TODAY” | wc -l` LOGFILE=$LOGFILE.$TODAY.$(($NUMFILES + 1)) else LOGFILE=$LOGFILE.$TODAY fi echo “`date` : scp -p weblogic@$SERVERNAME:/home/weblogic/$DOMAIN/$RMTLOGFILE $LOGARCHIVE/downloadtmp/$LOGFILE” >> $ROTATE_LOG scp -p weblogic@$SERVERNAME:/home/weblogic/$DOMAIN/$RMTLOGFILE $LOGARCHIVE/downloadtmp/$LOGFILE >> $ROTATE_LOG if [ $? == 0 ];then ssh weblogic@$SERVERNAME cat \/dev\/null \> \/home\/weblogic\/$DOMAIN\/$RMTLOGFILE mv $LOGARCHIVE/downloadtmp/$LOGFILE $LOGARCHIVE/$SERVERNAME/$DOMAIN/$LOGFILE #echo “mv $LOGARCHIVE/downloadtmp/$LOGFILE $LOGARCHIVE/$SERVERNAME/$DOMAIN/$LOGFILE” gzip $LOGARCHIVE/$SERVERNAME/$DOMAIN/$LOGFILE else log “Failed to download $SERVERNAME:/home/weblogic/$DOMAIN/$RMTLOGFILE” fi echo done
Hello sree, Thank you for contacting us. We spent some time looking into this, and recommend using rsync command instead. Thank you, John-Paul
I have a shell script that does logarchive from remote build linux server on all the production linux servers . This script runs nightly. Duirng this process, the log files on the production linux servers are changing to binary format and since this is production environment, cannot restart the servers. Is there a way to fix this. The line that basically does the logArchive in my script is below. ssh weblogic@$SERVERNAME cat \/dev\/null \> \/home\/weblogic\/$DOMAIN\/$RMTLOGFILE I can provide the entire script for reference.
Hello sree, Thank you for contacting us. Yes, can you provide the entire script for reference? This will help us narrow down the cause of the problems. Thank you, John-Paul