[BangPypers] File upload to Server using FTP in Django?

Gora Mohanty gora at mimirtech.com
Tue Sep 24 19:58:10 CEST 2013


On 24 September 2013 22:21, sameerkatti <sameerkatti at live.com> wrote:
> I am using the Django Framework and i have written a small snippet in a
> function in views.py
> The same function is called in the urls.py .
>
> The code in the Views is
>
> /session = ftplib.FTP('abc.com','Username','Password')
> file = open('filename','rb')
> session.storbinary('STOR filename', file)
> file.close()
> session.quit()/
>
> I am trying to upload a random file through the template, it throws a error
> as
> *'cannot concatenate 'str' and 'InMemoryUploadedFile' objects'*
>
> I'm very new to Django and Python.

I am sorry, but trying to help you is like trying to extract teeth.
Please provide sufficient details so that others without access
to your system can guess what is going on.

This code cannot possibly run, as there is a syntax error in the
very first line. Besides that:
* What is 'filename' on line 2? Does it exist?
* Where is 'filename' derived from?
* Where is the error thrown? I do not see anything in the above
   code which would cause that error, so my best guess is that
   you have not seen fit to show us the complete code.

Regards,
Gora


More information about the BangPypers mailing list