Erlang Mailing Lists

Author Message

<  Yaws mailing list  ~  Dupplicate call to Appmod:out in case of uploaded file size

Guest
Posted: Thu Jul 29, 2010 4:14 am Reply with quote
Guest
Sorry for my stupid question
I tried to write appmod to handle upload file, When uploaded file size > option max_file_size( about 50MB for exp), in out function, we have to return {ehtml, {p,[], "error message"}}, but the out function is called twice and in browser, i see "Connection Interrupted".
This is my code: out(Arg) -> Options = [{max_file_size, 10000000}], Ret = yaws_multipart:read_multipart_form(Arg, Options), case Ret of {done, UploadParams} -> {ehtml, {p,[], "File upload done"}}; {error, Reason} -> ErrDesc = wf:f("Error '~s'", [Reason]), {ehtml, {p,[], ErrDesc}}; {get_more, Cont, NewState} -> {get_more, Cont, NewState}; Other -> {ehtml, {p,[], "other reason"}} end. [/code]
I use debugger to investigated the Arg variables: with 1 upload request, there are 2 different Arg : < Arg = {arg,#Port<0.14942>, {{10,30,255,12},33023}, {headers,"keep-alive", "text/html,applition.... [/code]
< Arg = {arg,#Port<0.14947>, {{10,30,255,12},33076}, {headers,"keep-alive", "text/html,application [/code]
As you see there are 2 CliSock and 2 different Port number are created with only 1 upload request.
I try with normal get request or upload request with file size < max_file_size there are only 1 CliSock and the Arg is only 1, only 1 Port number.

I also tried return HTTP error code 413, which means "Request Entity too large"

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum