Hi Tushar, The approach you said is already implemented in ServiceEventHandler, this class puts the bytebuffer, filesize, filename & content type into service context
I tried to get these values, but I was not able to get the ByteBuffer. Any idea on this .. Thanks, Abdullah On Thu, Feb 19, 2009 at 12:45 PM, abdullah shaikh < [email protected]> wrote: > Thanks Tushar, I will try the given approach. > > > On Thu, Feb 19, 2009 at 12:33 PM, Tushar Abhyankar < > [email protected]> wrote: > >> One correction in the Note >> item is an FileItem object not an iterator object. >> >> You also require to Import >> import org.apache.commons.fileupload.FileItem; >> >> >> -----Original Message----- >> From: Tushar Abhyankar [mailto:[email protected]] >> Sent: Thursday, February 19, 2009 12:25 PM >> To: [email protected] >> Subject: RE: uploading party content >> >> Hi Abdullah, >> You won't get the form data directly when you use >> multipart/form-data we need to process the request the get the parameters. >> We use java end point to do that. I am not sure if it works with simple >> methods. >> >> Here is what I did >> >> I created a utility method that gets all the parameters when posted from >> form of enctype as multipart/form-data >> >> so here are some implementation pointers - >> >> I included >> import org.apache.commons.fileupload.servlet.ServletFileUpload; >> import org.apache.commons.fileupload.disk.DiskFileItemFactory; >> >> then in the method I used >> >> FileItemFactory factory = new DiskFileItemFactory(); >> ServletFileUpload upload = new ServletFileUpload(factory); >> >> And further did >> >> List items = upload.parseRequest(request); >> >> Now iterate the items list >> >> While iterating inside the loop you can fetch the parameters >> >> if (item.isFormField()) { >> String fieldName = item.getFieldName(); >> >> >> Note: item is an iterator object >> >> Thanks, >> Tushar J.Abhyankar >> Amicon Technologies Pvt. Ltd.(Mumbai) >> India's No. 1 OFBiz Service Provider. >> >> -----Original Message----- >> From: abdullah shaikh [mailto:[email protected]] >> Sent: Thursday, February 19, 2009 11:34 AM >> To: [email protected] >> Subject: uploading party content >> >> Hi All, >> >> >> I have a user registration form, wherein the user fill all the user >> details >> and can also upload a file. >> >> I have made the form enctype="multipart/form-data", method="post" and >> action="<@ofbizUrl>createUser</@ofbizUrl>" >> >> Below is my "createUser" request-map : >> >> <request-map uri="createUser> >> <event type="simple" path="com/test/UserEvents.xml" >> invoke="validateUserForm"/> >> <response name="success" type="request" value="createUserService"/> >> </request-map> >> >> I am validation the user registration form using simple-method, >> simple-map-processor. >> >> Now the issue is when I submit the form the form data is not submitted and >> that's why the validation fails, >> and if I remove enctype="multipart/form-data" the form data is submitted >> but >> I need to use enctype for file upload. >> >> >> What do I need to do to make the form work with the simple-method >> validation >> and enctype ? >> >> >> Thanks, >> Abdullah >> >> >
