little how-to required :)

View: New views
2 Messages — Rating Filter:   Alert me  

little how-to required :)

by rama.rama@tiscali.it :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi all,

i have some doubt on how i can read the content of a file
sended via form

suppose that i have something like

        <form
method="post" action="blablabla" enctype="multipart/form-data">

            <input type="file" name="user_file" />
            <input
type="submit"  />
        </form>


and on my mighty java application i
have a
GrizzlyWebServer --> GrizzlyAdapter --> service(req,res)

it's
not really clear to me how i can do that..
basically what i want to
achive is the ability to
1) detect a file upload (not based on a name
of a hidden post var obviusly)
2) read all the data (binary mode, to be
sure that i can save jpeg or stuff like that)

tnx for help!




Passa a Tiscali Tutto Incluso Light: telefono + adsl 8 Mb senza limiti a soli 9,95 euro al mese fino al 01/04/2010.   Gratis la Sim Tiscali Mobile con 25 euro di traffico.  L’offerta è valida solo se attivi entro il 29/10/09   http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/tuttoincluso_light/?WT.mc_id=01fw

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: little how-to required :)

by Oleksiy Stashok :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rama,

this is what I think you can do:

InputBuffer ib = req.getInputBuffer();
ByteChunk buffer = new ByteChunk();

while (true)
        int count = ib.doRead(buffer, req);

        if (count == -1) break;

        // parse ByteChunk
};

WBR,
Alexey.


On Oct 26, 2009, at 17:49 , rama.rama@... wrote:

> hi all,
>
> i have some doubt on how i can read the content of a file
> sended via form
>
> suppose that i have something like
>
>        <form
> method="post" action="blablabla" enctype="multipart/form-data">
>
>            <input type="file" name="user_file" />
>            <input
> type="submit"  />
>        </form>
>
>
> and on my mighty java application i
> have a
> GrizzlyWebServer --> GrizzlyAdapter --> service(req,res)
>
> it's
> not really clear to me how i can do that..
> basically what i want to
> achive is the ability to
> 1) detect a file upload (not based on a name
> of a hidden post var obviusly)
> 2) read all the data (binary mode, to be
> sure that i can save jpeg or stuff like that)
>
> tnx for help!
>
>
>
>
> Passa a Tiscali Tutto Incluso Light: telefono + adsl 8 Mb senza  
> limiti a soli 9,95 euro al mese fino al 01/04/2010.   Gratis la Sim  
> Tiscali Mobile con 25 euro di traffico.  L’offerta è valida solo se  
> attivi entro il 29/10/09   http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/tuttoincluso_light/?WT.mc_id=01fw
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...