file upload - ajax

This is the place for queries that don't fit in any of the other categories.

file upload - ajax

Postby trogne » Tue Sep 24, 2013 5:41 pm

There's a python file upload script in the course HTML 5 Power by Andy Olsen.

The problem is that the upload doesn't occurs (file not transfered).

Please see there :
http://stackoverflow.com/questions/1898 ... s-the-file

It's unresolved.

What is exactly missing in the python so that the file upload occurs ?


Thanks,

Patrick
Last edited by Mekire on Wed Sep 25, 2013 1:59 pm, edited 1 time in total.
Reason: First post lock.
trogne
 
Posts: 2
Joined: Tue Sep 24, 2013 5:36 pm

Re: file upload - ajax

Postby ochichinyezaboombwa » Tue Sep 24, 2013 9:16 pm

You are just reading the data 1 byte at a time (which BTW is very inefficient), but throwing it away instantly:
Code: Select all
     while bytes_read < content_length:
            x = self.rfile.read(1)
            bytes_read += 1
            # you never use x!!!


You need to store data in some object and then actually save it as a file.
Your code does nothing in respect to these.
ochichinyezaboombwa
 
Posts: 200
Joined: Tue Jun 04, 2013 7:53 pm

Re: file upload - ajax

Postby trogne » Wed Sep 25, 2013 1:50 pm

I see, I never use x.

Would you be kind enough to add the exact code so that the file be uploaded?


Thanks,

Patrick
trogne
 
Posts: 2
Joined: Tue Sep 24, 2013 5:36 pm


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 1 guest