FYI https://issues.apache.org/jira/browse/SLING-2166 (file upload limit)


-----Original Message-----
From: Jithesh A P [mailto:jithesh...@gmail.com] 
Sent: Thursday, August 25, 2011 4:11 PM
To: users@sling.apache.org
Subject: Re: processing POST help - direction needed

Thanks Mark.

Regards
Jithesh



On Thursday, August 25, 2011 at 1:07 PM, Mark Herman wrote:

> Not that I'm aware of. 
> 
> One thing I noticed, with the example I gave you, there are some limits
with
> request.getParameter() [1] (Servlet API) so you may want to use
> slingRequest.getRequestParameter() [2] (Sling API) instead. That will give
> you .getSize() and .getInputStream().
> 
> [1] http://sling.apache.org/site/request-parameters.html
> [2]
>
http://sling.apache.org/apidocs/sling5/org/apache/sling/api/request/RequestPa
> rameter.html
> -----Original Message-----
> From: Jithesh A P [mailto:jithesh...@gmail.com] 
> Sent: Thursday, August 25, 2011 3:44 PM
> To: users@sling.apache.org (mailto:users@sling.apache.org)
> Subject: Re: processing POST help - direction needed
> 
> A quick follow up question, i was browsing documentation and i think there
is
> no configurable parameter at present to set the max file size that can be
> uploaded. I hope i am right, unless i missed something. If such a thing was
> there that could have helped me as well :)
> 
> Regards
> Jithesh
> 
> 
> 
> On Thursday, August 25, 2011 at 12:39 PM, Jithesh A P wrote:
> 
> >  Hmm ok. I don't have the virus api yet, i will be provided with one
soon. 
> > Let me start from this suggestion below and and get hold of some person
who
> can help me out with java as needed.
> > 
> > Thanks for the 
> > 
> > Regards
> > Jithesh
> > 
> > On Thursday, August 25, 2011 at 12:10 PM, Mark Herman wrote:
> > 
> > > The 3rd example of a POST.jsp gets you 90% of the way there, but I
don't
> see
> > > how you're going to completely avoid java. 
> > > How do you plan on performing this virus scan?
> > > 
> > > Assuming you have some java based virus scan api, you can take the
> POST.jsp
> > > they give you and replace this line:
> > > 
> > > contentNode.setProperty("jcr:data", new
> > > ByteArrayInputStream(request.getParameter("myfile").getBytes()));
> > > 
> > > with something like: 
> > > 
> > > byte[] bytes = request.getParameter("myfile").getBytes();
> > > if(bytes.length > 1024*1024*2 ) {
> > >  //larger than 2MB so throw exception or something
> > > }
> > > if(AntivirusUtility.isDirty(bytes)){
> > >  //infected so throw exception
> > > }
> > > contentNode.setProperty("jcr:data", new ByteArrayInputStream(bytes));
> > > ...
> > > 
> > > 
> > > -----Original Message-----
> > > From: Jithesh A P [mailto:jithesh...@gmail.com] 
> > > Sent: Thursday, August 25, 2011 2:31 PM
> > > To: users@sling.apache.org (mailto:users@sling.apache.org)
> > > Subject: Re: processing POST help - direction needed
> > > 
> > > Thank you very much for the quick response Mark. I did have a look at
> that
> > > link, but did not get an answer to what i was looking for. Let me
> elaborate.
> > > Let me put it in simple terms (without getting into my need complexity
> :)),
> > > What i need is
> > > I have an HTML form to upload files. 
> > > I can hand it over to sling to do the post after file is selected, 
> > > but before that i want to check if the file has virus, 
> > > or is within the permitted file size & type (this i can do with
> javascript,
> > > but if there is a user who uses curl to upload, need to trap that)
> > > 
> > > After i trap and validate the file is fine for upload, i need to hand
it
> over
> > > to sling to finish the POST operation
> > > 
> > > I hope this gives an idea of the scenario. I am not a JAVA person, so
> trying
> > > to see if i can accomplish this with something like POST.esp :).
> > > 
> > > 
> > > Regards
> > > Jithesh
> > > 
> > > 
> > > 
> > > On Thursday, August 25, 2011 at 11:22 AM, Mark Herman wrote:
> > > 
> > > > Not sure about "hand it back to normal POST operation" but this[1]
may
> get
> > > > you what you need.
> > > > 
> > > > [1]
http://dev.day.com/content/ddc/blog/2008/07/fileuploadsinsling.html
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Jithesh A P [mailto:jithesh...@gmail.com] 
> > > > Sent: Thursday, August 25, 2011 1:59 PM
> > > > To: users@sling.apache.org (mailto:users@sling.apache.org)
> (mailto:users@sling.apache.org)
> > > > Subject: processing POST help - direction needed
> > > > 
> > > > Hi Folks,
> > > > 
> > > > I am stuck at how to handle post of a file. For example i want to
> upload a
> > > > file, do some processing like check for virus (during POST), then
hand
> it
> > > > back to normal POST operation.
> > > > 
> > > > Is it possible to achieve this using POST.esp and how?
> > > > 
> > > > Your input will be greatly appreciated.
> > > > 
> > > > Regards
> > > > Jithesh

Reply via email to