File Upload

361 views
Skip to first unread message

Arun Papnoi

unread,
Jun 14, 2013, 7:59:18 AM6/14/13
to ve...@googlegroups.com
Hi Guys.
Please help how to handle file upload from the browser in a vert.x web application

Norman Maurer

unread,
Jun 14, 2013, 8:00:50 AM6/14/13
to ve...@googlegroups.com
Checkout the vertx-example project…

For example for java:


Bye,
Norman

Am 14.06.2013 um 13:59 schrieb Arun Papnoi <arunp...@gmail.com>:

Hi Guys.
Please help how to handle file upload from the browser in a vert.x web application

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Arun Papnoi

unread,
Jun 17, 2013, 9:14:47 AM6/17/13
to ve...@googlegroups.com, norman...@googlemail.com
thanks  Norman , 
 But can you suggest some code in Groovy please. 

Tim Fox

unread,
Jun 17, 2013, 9:19:16 AM6/17/13
to ve...@googlegroups.com
On 17/06/13 14:14, Arun Papnoi wrote:
> thanks Norman ,
> But can you suggest some code in Groovy please.

There are examples in the 2.0 docs
>
> On Friday, June 14, 2013 5:30:50 PM UTC+5:30, Norman Maurer wrote:
>> Checkout the vertx-example project�
>>
>> For example for java:
>>
>>
>> https://github.com/vert-x/vertx-examples/tree/master/src/main/java/simpleformupload
>>
>> Bye,
>> Norman
>> Am 14.06.2013 um 13:59 schrieb Arun Papnoi <arunp...@gmail.com<javascript:>
>>> :
>> Hi Guys.
>> Please help how to handle file upload from the browser in a vert.x web
>> application
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "vert.x" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to vertx+un...@googlegroups.com <javascript:>.

Arun Papnoi

unread,
Jun 18, 2013, 1:29:15 AM6/18/13
to ve...@googlegroups.com
But in case of image upload it uploads only 0 kb , not able to upload images from examples.

expert china

unread,
Jun 18, 2013, 4:01:38 AM6/18/13
to ve...@googlegroups.com

def rm = new RouteMatcher()
 
   rm.post('/upload/'){ req->
req.uploadHandler { upload ->
 upload.exceptionHandler { cause ->
req.response.end(">>>>>>>>>>Upload failed");
 }

 upload.endHandler {
println ">>>>>>>>>upload ok!"
req.response.end("Upload successful, you should see the file in the server directory");
 }
 upload.streamToFileSystem(upload.filename);
 println "upload handle>>>"
    }

}

I test it in vertx 2.0 CR1:

upload from chrome browser, OK!
upload from phonegap app, nothing upload!( client upload progress bar keep  in 99%, never 100%)




2013/6/18 Arun Papnoi <arunp...@gmail.com>
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.

Tim Fox

unread,
Jun 18, 2013, 4:07:18 AM6/18/13
to ve...@googlegroups.com
Please use gist.github.com, also please provide an example with all the
unnecessary stuff removed - e.g. is the routematcher really necessary?
>>>>> Checkout the vertx-example project�
>>>>>
>>>>> For example for java:
>>>>>
>>>>>
>>>>> https://github.com/vert-x/**vertx-examples/tree/master/**
>>> src/main/java/simpleformupload<https://github.com/vert-x/vertx-examples/tree/master/src/main/java/simpleformupload>
>>>>> Bye,
>>>>> Norman
>>>>> Am 14.06.2013 um 13:59 schrieb Arun Papnoi <arunp...@gmail.com<**javascript:>
>>>>>> :
>>>>> Hi Guys.
>>>>> Please help how to handle file upload from the browser in a vert.x web
>>>>> application
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>> Groups
>>>>> "vert.x" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>>>> email to vertx+un...@googlegroups.com <javascript:>.
>>>>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>.

Tim Fox

unread,
Jun 18, 2013, 6:12:02 AM6/18/13
to ve...@googlegroups.com
I've just tested the simpleformupload example in vertx-examples and it
works fine for me.

On 18/06/13 09:01, expert china wrote:
>>>>> Checkout the vertx-example project�
>>>>>
>>>>> For example for java:
>>>>>
>>>>>
>>>>> https://github.com/vert-x/**vertx-examples/tree/master/**
>>> src/main/java/simpleformupload<https://github.com/vert-x/vertx-examples/tree/master/src/main/java/simpleformupload>
>>>>> Bye,
>>>>> Norman
>>>>> Am 14.06.2013 um 13:59 schrieb Arun Papnoi <arunp...@gmail.com<**javascript:>
>>>>>> :
>>>>> Hi Guys.
>>>>> Please help how to handle file upload from the browser in a vert.x web
>>>>> application
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>> Groups
>>>>> "vert.x" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>>>> email to vertx+un...@googlegroups.com <javascript:>.
>>>>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>.

Arun Papnoi

unread,
Jun 19, 2013, 2:07:44 AM6/19/13
to ve...@googlegroups.com
Hi I used file upload in vertx with groovy

and it is giving me the following error...

Exception in Groovy verticle 
groovy.lang.MissingMethodException: No signature of method: org.vertx.groovy.core.http.HttpServerRequest.uploadHandler() is applicable for argument types: (webapp.App$_run_closure4_closure10) 
pls suggest..
>>>>> Checkout the vertx-example project�

Tim Fox

unread,
Jun 19, 2013, 3:03:25 AM6/19/13
to ve...@googlegroups.com
You must be using an old version of Vert.x

On 19/06/13 07:07, Arun Papnoi wrote:
> Hi I used file upload in vertx with groovy
> from
> https://github.com/vert-x/vertx-examples/blob/master/src/main/groovy/simpleformupload<https://github.com/vert-x/vertx-examples/blob/master/src/main/groovy/simpleformupload/SimpleFormUploadServer.groovy>
>
>
> and it is giving me the following error...
>
> *Exception in Groovy verticle *
> *groovy.lang.MissingMethodException: No signature of method:
> org.vertx.groovy.core.http.HttpServerRequest.uploadHandler() is applicable
> for argument types: (webapp.App$_run_closure4_closure10) *
> pls suggest..
>
>
> On Tuesday, June 18, 2013 3:42:02 PM UTC+5:30, Tim Fox wrote:
>> I've just tested the simpleformupload example in vertx-examples and it
>> works fine for me.
>>
>> On 18/06/13 09:01, expert china wrote:
>>> def rm = new RouteMatcher()
>>>
>>> rm.post('/upload/'){ req->
>>> req.uploadHandler { upload ->
>>> upload.exceptionHandler { cause ->
>>> req.response.end(">>>>>>>>>>Upload failed");
>>> }
>>>
>>> upload.endHandler {
>>> println ">>>>>>>>>upload ok!"
>>> req.response.end("Upload successful, you should see the file in the
>> server
>>> directory");
>>> }
>>> upload.streamToFileSystem(upload.filename);
>>> println "upload handle>>>"
>>> }
>>>
>>> }
>>>
>>> I test it in vertx 2.0 CR1:
>>>
>>> upload from chrome browser, OK!
>>> upload from phonegap app, nothing upload!( client upload progress bar
>> keep
>>> in 99%, never 100%)
>>>
>>>
>>>
>>>
>>> 2013/6/18 Arun Papnoi <arunp...@gmail.com <javascript:>>
>>>
>>>> But in case of image upload it uploads only 0 kb , not able to upload
>>>> images from examples.
>>>>
>>>>
>>>> On Monday, June 17, 2013 6:49:16 PM UTC+5:30, Tim Fox wrote:
>>>>
>>>>> On 17/06/13 14:14, Arun Papnoi wrote:
>>>>>> thanks Norman ,
>>>>>> But can you suggest some code in Groovy please.
>>>>> There are examples in the 2.0 docs
>>>>>> On Friday, June 14, 2013 5:30:50 PM UTC+5:30, Norman Maurer wrote:
>>>>>>> Checkout the vertx-example project�
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>

Arun Papnoi

unread,
Jun 19, 2013, 4:26:57 AM6/19/13
to ve...@googlegroups.com
m using vert.x-1.3.1.final
>>>>>>> Checkout the vertx-example project�

Tim Fox

unread,
Jun 19, 2013, 4:30:05 AM6/19/13
to ve...@googlegroups.com
All those examples are for 2.0, not 1.x. Html file upload is new in 2.0
>>>>>>>>> Checkout the vertx-example project�
Reply all
Reply to author
Forward
0 new messages