Question

I am using Eclipse Juno, GWT, Java and am a novice.

Can anyone please point me to a good tutorial for using FileUpload to capture the path of an image, display the image in the View and then storing the image as a Blob in MySQL. I have found a very good tutorial for GAE. However, I am not using GAE.

What I am looking at is:

  1. Using a change handler on the FileUpload to trigger the capture of the image's path and display the image. However, I understand that this requires a Server side call and that the image needs to be temporarily stored (or does it need to be stored in the DB at this point, read from the DB to display and the row deleted if not needed?).

  2. Using a Button click event to store the image as a Blob in MySQL.

Thanks for your help,

Glyn

Was it helpful?

Solution

As you say, the main thing is to develop a servlet to get the file and put it anywere in the server (filesystem, database, etc). Additionally you have to offer a servlet to return the file to the client to display it.

I would use gwtupload, which makes all the process pretty simpler. Take a look to the example in the gwtupload GettingStarted. It does almost everything you need except that it stores the file in a folder and maintain a list in memory to get a file given it's client id. The only thing you have to modify is the part where the servlet stores the file in a folder (executeAction), and the part where the servlet returns the file to the client (getUploadedFile), and change it to store/read the file into mysql.

Using gwtupload, you have other nice features like the ability to customize the FileUpload button, progress bar, multiple uploads etc.

OTHER TIPS

I think you may try to use gwtupload - https://code.google.com/p/gwtupload/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top