Hi all...

I am trying to upload 4 files on a local disk, onto a remote ftp server. All of them are in the same folder(in local machine).
I am using the storbinary function of ftplib.

Following are the file sizes:

1-- 70 KB
2-- 60 KB
3-- 73 KB
4-- 8,100 KB

The first 3 files get uploaded successfully, but while trying to upload the 4th file, an ftplib.error_perm exception is thrown, which says "500, sorry file is not supported for uploading"

I don't think there is any permission constraint, since the first three images get uploaded without problem, and all of them are in the same folder.

Is there any limit on file size that can be uploaded by storbinary()??


plz help me..

Dani AI

Generated

Quick summary: Python's ftplib.storbinary has no built‑in tiny size limit — FTP and ftplib can handle multi‑megabyte transfers. The server reply "500, sorry file is not supported for uploading" is a server response (500 = syntax/unrecognized command) and usually means the server rejected the STOR command or the submitted argument. Given 's note that FileZilla succeeds and ' remark about 500 meaning a bad command line, the difference is almost certainly in how the script sends the file (transfer mode / command / filename) or in a server policy/filter.

Key points and troubleshooting checklist (actionable, in order):

  • Confirm the script is performing a binary STOR transfer and is handing storbinary a file‑like object (not the result of file.read()). If the file object was read earlier, reset its position to the start before calling storbinary.

  • Turn on protocol tracing to capture the exact FTP commands and server replies. Example debugging calls:

    ftp.set_debuglevel(2)
    ftp.set_pasv(True)   # try toggling True/False to test passive vs active mode

    Compare the STOR line emitted by the script with what FileZilla sends; look for extra path info, embedded spaces, non‑ASCII characters, or an overly long command line.

  • Test by renaming the large file to a short, simple name and retrying. Also try uploading a different file of similar size/extension to check for server filters based on extension or content.

  • Check server‑side limits: per‑user quotas, directory quotas, disk full, or explicit file‑type/size policy. If FileZilla works but the script does not, inspect server logs (or ask the host) to see why that STOR was rejected.

Bottom line: storbinary itself is fine for large files. The usual culprits are transfer mode / how the file object is passed, filename/command formatting, passive/active mode, or server-side filtering — capturing the FTP debug trace will show which.

Recommended Answers

All 7 Replies

8 MB is not a very large size. You could try and upload the file with filezilla first to see if the FTP server accepts this file.

thanks for a reply......

ya i tried by uploading the file through filezilla ,filezilla will upload that file but i cant upload through script????

plz help me ......

Difficult help because others have not same problem. I can do without problem:

>>> ysisoft = ftplib.FTP('ftp.ysisoft.com', user,password)
>>> ysisoft.storbinary('STOR PyScripter-v2.4.1-Setup.exe',open("k:/Lataukset/PyScripter-v2.4.1-Setup.exe"))
'226 Transfer complete'
>>>

After checking actually it did not transfer all.

ysisoft.dir('PyS*')
-rw-r--r--   1 ******** ftpusers   114110 Mar 28 01:18 PyScripter-v2.4.1-Setup.exe

I forgot to include 'rb' for open:

>>> with open("k:/Lataukset/PyScripter-v2.4.1-Setup.exe") as filein:
	program = filein.read()

	
>>> len(program)
26
>>> with open("k:/Lataukset/PyScripter-v2.4.1-Setup.exe", 'rb') as filein:
	program = filein.read()

	
>>> len(program)
4324886

So like this it works for me finally:

>>> with open("k:/Lataukset/PyScripter-v2.4.1-Setup.exe", 'rb') as filein:
	ysisoft.storbinary('STOR PyScripter-v2.4.1-Setup.exe',filein)

	
'226 Transfer complete'

>>> ysisoft.dir('PyS*')
-rw-r--r--   1 ******** ftpusers  4324886 Mar 28 01:25 PyScripter-v2.4.1-Setup.exe
>>>>>> ysisoft.close()

plz help me ......

The FTP error 500 is described as "syntax error, unrecognized command", and may include a too long command line, so it may have something to do with the name of the file, or the path to the file.

i have to upload a image on web page

still i cant upload a image on we

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.