How can I do that.
Thanks in advance
zuje
private Hidden formTime = new Hidden();
private HorizontalPanel formHP=new HorizontalPanel();
public FormPanel uploadForm=new FormPanel();//form
formTime.setName("time");
formTime.setValue(""+picTime);
formHP.add(formTime);
uploadForm.add(formHP);
then on the server.....something along these lines.....
public synchronized void doPost(HttpServletRequest request,
HttpServletResponse res)throws ServletException, IOException{
res.setContentType("text/html;charset=utf-8");
item=null;
//System.err.println("selectMstsq: "+selectMstsq);
if(myWeb==null)myWeb=new PictureUploadServer();
File tempFolder =
(File)request.getSession().getServletContext().getAttribute("com.google.gwt.dev.shell.outdir");
//Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
items = new LinkedList();
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
iter = items.iterator();
while (iter.hasNext()) {
item = (FileItem) iter.next();
String name = item.getFieldName();
if(name.compareTo("time") == 0){
picTime=Long.parseLong(item.getString());
}else if(name.startsWith("picture")){
uploadedStream = item.getInputStream();
/* This is to dump the upload to disk (create file)
* To keep in memory, change the output stream to
* ByteArrayOutputStream, writing file contents
* into a byte array.
* This byte array can be used as input to a ByteInputSream
* which in turn can be written to javax.sql.InputStream
*/
}
}
}
Hope that spoon feeding has filled you up, :).
On Mar 8, 2:21 pm, mon3y <darkside...@hotmail.com> wrote:
> What i do is i add hidden inputs to the form i'm submitting along with
> my picture, like so....
>
> private Hidden formTime = new Hidden();
> private HorizontalPanel formHP=new HorizontalPanel();
> public FormPanel uploadForm=new FormPanel();//form
>
> formTime.setName("time");
> formTime.setValue(""+picTime);
> formHP.add(formTime);
> uploadForm.add(formHP);
>
> then on the server.....something along these lines.....
>
> public synchronized void doPost(HttpServletRequest request,
> HttpServletResponse res)throws ServletException, IOException{
> res.setContentType("text/html;charset=utf-8");
>
> item=null;
>
> //System.err.println("selectMstsq: "+selectMstsq);
> if(myWeb==null)myWeb=new PictureUploadServer();
>
> File tempFolder =
> (File)request.getSession().getServletContext().getAttribute("com.google.gwt.dev.shell.outdir");
> > zuje- Hide quoted text -
>
> - Show quoted text -