Re: Upload a File using the request.POST data

2010-09-27 Thread Sam Lai
On 27 September 2010 14:31, Danny Bos  wrote:
> There is no form, it's entirely Javascript.
> Spoke to the creator of the script, who has popped up script examples
> for PHP and ColdFusion he reckons:
>
> "You basically have to put the whole post contents into a file."

Hmm... a little difficult seeing as Django parses the POST contents
into a string first, so it has probably done irreversible things to
it.

There is HttpRequest.raw_post_data though, but not sure what format
that is in. If it is just bytes, you could just stream that to
wherever you need it to be.

> Not altogether helpful, eh?
>
> d
>
>
> On Sep 27, 1:52 pm, Sam Lai  wrote:
>> Have you got the right attribute in the form?
>>
>> Fromhttp://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>>
>> "Note that request.FILES will only contain data if the request method
>> was POST and the  that posted the request has the attribute
>> enctype="multipart/form-data". Otherwise, request.FILES will be
>> empty."
>>
>> On 27 September 2010 13:21, Danny Bos  wrote:
>>
>> > Can it even be done?
>> > It seems pretty ordinary but everything I'm trying expects it to be a
>> > request.FILE.
>>
>> > Frustrating stuff.
>>
>> > d
>>
>> > On Sep 27, 11:24 am, Danny Bos  wrote:
>> >> Heya,
>>
>> >> I'm using the 'Valums File Uploader' which passes the file in the
>> >> request.POST as you can see below. I'm wondering how to get that data
>> >> into an actual file. Any ideas would be great as things like "for
>> >> chunk in f.chunks()" only works on request.FILES which in this case is
>> >> empty.
>>
>> >> Thanks,
>> >> Hope all is well your side of the planet.
>>
>> >> Eg DATA:
>>
>> >> GET:,
>> >> POST:> >> \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
>> >> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
>> >> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
>> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
>> >> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
>> >> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
>> >> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
>> >> u'\uff ... Etc ...
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
There is no form, it's entirely Javascript.
Spoke to the creator of the script, who has popped up script examples
for PHP and ColdFusion he reckons:

"You basically have to put the whole post contents into a file."

Not altogether helpful, eh?

d


On Sep 27, 1:52 pm, Sam Lai  wrote:
> Have you got the right attribute in the form?
>
> Fromhttp://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> "Note that request.FILES will only contain data if the request method
> was POST and the  that posted the request has the attribute
> enctype="multipart/form-data". Otherwise, request.FILES will be
> empty."
>
> On 27 September 2010 13:21, Danny Bos  wrote:
>
> > Can it even be done?
> > It seems pretty ordinary but everything I'm trying expects it to be a
> > request.FILE.
>
> > Frustrating stuff.
>
> > d
>
> > On Sep 27, 11:24 am, Danny Bos  wrote:
> >> Heya,
>
> >> I'm using the 'Valums File Uploader' which passes the file in the
> >> request.POST as you can see below. I'm wondering how to get that data
> >> into an actual file. Any ideas would be great as things like "for
> >> chunk in f.chunks()" only works on request.FILES which in this case is
> >> empty.
>
> >> Thanks,
> >> Hope all is well your side of the planet.
>
> >> Eg DATA:
>
> >> GET:,
> >> POST: >> \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
> >> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
> >> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> >> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
> >> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
> >> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
> >> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
> >> u'\uff ... Etc ...
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Upload a File using the request.POST data

2010-09-26 Thread Sam Lai
Have you got the right attribute in the form?

>From http://docs.djangoproject.com/en/dev/topics/http/file-uploads/

"Note that request.FILES will only contain data if the request method
was POST and the  that posted the request has the attribute
enctype="multipart/form-data". Otherwise, request.FILES will be
empty."

On 27 September 2010 13:21, Danny Bos  wrote:
> Can it even be done?
> It seems pretty ordinary but everything I'm trying expects it to be a
> request.FILE.
>
> Frustrating stuff.
>
>
> d
>
> On Sep 27, 11:24 am, Danny Bos  wrote:
>> Heya,
>>
>> I'm using the 'Valums File Uploader' which passes the file in the
>> request.POST as you can see below. I'm wondering how to get that data
>> into an actual file. Any ideas would be great as things like "for
>> chunk in f.chunks()" only works on request.FILES which in this case is
>> empty.
>>
>> Thanks,
>> Hope all is well your side of the planet.
>>
>> Eg DATA:
>>
>> GET:,
>> POST:> \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
>> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
>> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
>> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
>> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
>> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
>> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
>> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
>> u'\uff ... Etc ...
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Can it even be done?
It seems pretty ordinary but everything I'm trying expects it to be a
request.FILE.

Frustrating stuff.


d

On Sep 27, 11:24 am, Danny Bos  wrote:
> Heya,
>
> I'm using the 'Valums File Uploader' which passes the file in the
> request.POST as you can see below. I'm wondering how to get that data
> into an actual file. Any ideas would be great as things like "for
> chunk in f.chunks()" only works on request.FILES which in this case is
> empty.
>
> Thanks,
> Hope all is well your side of the planet.
>
> Eg DATA:
>
> GET:,
> POST: \ufffd\x03\ufffd\x05\ufffd\ufffd\ufffdC\ufffdC\x1b\ufffd\ufffd\x0f/
> \x1eY:\ufffdZ\ufffd \ufffd8': [u''], u'5]]\x1f\u04ff\x7f\ufffd\ufffd
> \ufffd\x0f\x054\x15\u0622i\x1c\ufffd(\ufffdG\x01 \ufffd\x03u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\x02 \ufffd\x01u
> \x05\ufffdL]b*\x002\x18PW\x00\ufffd\ufffd%\ufffd\ufffd\ufffd\ufffd$X]]
> \u0775k\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdt\ufffd_2\x13\ufffd\u01cf
> \x1fkkk\ufffd\ufffd\ufffdUe\ufffd\ufffd\ufffd\ufffdt2\u04ef\x1f?~|
> \ufffd\u0529\ufffd\ufffd$\ufffdx}\ufffd\ufffd*\ufffdNw9': [u''],
> u'\uff ... Etc ...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Upload a File using the request.POST data

2010-09-26 Thread Danny Bos
Heya,

I'm using the 'Valums File Uploader' which passes the file in the
request.POST as you can see below. I'm wondering how to get that data
into an actual file. Any ideas would be great as things like "for
chunk in f.chunks()" only works on request.FILES which in this case is
empty.

Thanks,
Hope all is well your side of the planet.

Eg DATA:

GET:,
POST:http://groups.google.com/group/django-users?hl=en.