Re: [web2py] Check upload file size before actual file data uploading

2012-10-02 Thread Johann Spies
On 2 October 2012 04:20, Exeption vvm1...@gmail.com wrote:

 Hi,

 Already have asked 
 herehttp://stackoverflow.com/questions/12668310/check-upload-file-size-before-actual-file-data-uploading,
 but no reply.

 I will duplicate my question here:

 In my web2py controller I'm accessing file data like:

 vfile = request.post_vars.video.file

 But how can I check Content-Length *before* actual file data will be
 uploaded? It is not a good idea for me to check file size after file
 already uploaded.

 NOTE: I'm not using FORM() helper and database but just raw regular file
 upload. Is there any way to hook into web2py internals to do what I need?


I suspect you will have to use javascript to do this.  I have just search
for 'javascript file size before upload'  and saw answers that should not
be too difficult to use in your case.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 





Re: [web2py] Check upload file size before actual file data uploading

2012-10-02 Thread Massimo Di Pierro
You can try this:

In the upload form add input type='hidden' name='X-Progress-ID' 
value='test'/


def upload_page():
 ...
 length_bytes = cache.ram('X-Progress-ID:test:length',None,0)
 uploaded_bytes = cache.ram('X-Progress-ID:test:uploaded',None,0)
 ...

they are updated during the upload. Hope this helps.


On Tuesday, 2 October 2012 01:57:25 UTC-5, Johann Spies wrote:

 On 2 October 2012 04:20, Exeption vvm...@gmail.com javascript: wrote:

 Hi,

 Already have asked 
 herehttp://stackoverflow.com/questions/12668310/check-upload-file-size-before-actual-file-data-uploading,
  
 but no reply.

 I will duplicate my question here:

 In my web2py controller I'm accessing file data like:

 vfile = request.post_vars.video.file

 But how can I check Content-Length *before* actual file data will be 
 uploaded? It is not a good idea for me to check file size after file 
 already uploaded.

 NOTE: I'm not using FORM() helper and database but just raw regular file 
 upload. Is there any way to hook into web2py internals to do what I need?


 I suspect you will have to use javascript to do this.  I have just search 
 for 'javascript file size before upload'  and saw answers that should not 
 be too difficult to use in your case.

 Regards
 Johann

 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)



-- 





[web2py] Check upload file size before actual file data uploading

2012-10-01 Thread Exeption
Hi,

Already have asked 
herehttp://stackoverflow.com/questions/12668310/check-upload-file-size-before-actual-file-data-uploading,
 
but no reply.

I will duplicate my question here:

In my web2py controller I'm accessing file data like:

vfile = request.post_vars.video.file

But how can I check Content-Length *before* actual file data will be 
uploaded? It is not a good idea for me to check file size after file 
already uploaded.

NOTE: I'm not using FORM() helper and database but just raw regular file 
upload. Is there any way to hook into web2py internals to do what I need?


Thanks!

--