upload image into datastore,and display on webpage here http://www.hapeblog.com/blog.shtml?id=2002
2010/3/15 rissen <[email protected]> > In my app , I upload image file by Apache Commons FileUpload and save > it in datastore, then get the binary data from the datastore and > display the image in serlvet. > the detail : http://mimaiji.appspot.com/article?method=view&id=9001 > > > > > > On 3月2日, 下午11时37分, Valentino Hankypants <[email protected]> wrote: > > hi jake, > > > > thanks for your replies. > > in my case i have jsp-page with a form. the user should have the > > possibility to select a file. i used the <input type="file" > > name="test"> directive from html. > > after the user selected a file, he clicks a button. by clicking this > > button the binary data of the selected file should be read and saved > > in a blob in the GAE storage. > > afterwards i'll give the user the possibility to open the uploaded > > file by clicking a link... > > > > therefore, should i use this gaevfs or not? > > > > up to now my major problem is, how can i get the binary data from the > > form in my servlet class where i handle the form actions? i got all > > other informations by HttpServletRequest.getParameter("test"); > > > > greatz and hoping for some help ;-) > > flo > > > > On 2 Mrz., 15:24, Jake <[email protected]> wrote: > > > > > You're not limited to 1MB - you're just limited to using 1MB > > > entities. The GAEVFS link I sent you implies that it's files can span > > > multiple entities. As Mrityunjay stated, though, large storage > > > requires payment. See the quotas for details: > http://code.google.com/appengine/docs/quotas.html > > > > > Jake > > > > > On Mar 1, 12:43 pm, Valentino Hankypants <[email protected]> wrote: > > > > > > so i only can upload binary data up to 1 MB? > > > > any possibility to upload binary data with GBs? > > > > > > greatz > > > > > > On 1 Mrz., 18:36, Jake <[email protected]> wrote: > > > > > > > Hey, > > > > > > > Saving binary data to the datastore isn't too difficult - you can > just > > > > > use a Blob type and ensure that you don't break the 1MB capacity of > a > > > > > single entity. You can see my class declaration below. The "hard" > > > > > part is converting a file upload to a byte[] and then from a byte[] > > > > > back into what you would consider a "downloadable" file. That > > > > > depends, somewhat, on your implementation. For example, I use the > > > > > Wicket architecture and all I need to do is > > > > > > > FileUpload f = fileUploadField.getFileUpload(); > > > > > BinaryFileData b = new BinaryFileData(f.getBytes()); > > > > > pm.makePersistent(b); > > > > > > > I presume you are not using Wicket, but some other framework. > You'll > > > > > need to look into how it handles file uploads. > > > > > > > You may also find this interesting: > http://code.google.com/p/gaevfs/ > > > > > I haven't used it, but it skips the whole byte[] thing entirely. > > > > > > > Jake > > > > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > > > > public class BinaryFileData implements Serializable { > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > @PrimaryKey > > > > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > > > > private Key key; > > > > > > > @Persistent > > > > > private String name; > > > > > > > @Persistent > > > > > private String mimeType; > > > > > > > @Persistent(defaultFetchGroup="true") > > > > > private Blob data; > > > > > > > public BinaryFileData(byte[] bytes) { > > > > > this.data = new Blob(bytes); > > > > > } > > > > > > > public byte[] getData() { > > > > > return data.getBytes(); > > > > > } > > > > > > > public void setData(byte[] d) { > > > > > this.data = new Blob(d); > > > > > } > > > > > > > } > > > > > > > On Mar 1, 11:25 am, Valentino Hankypants <[email protected]> wrote: > > > > > > > > hello together, > > > > > > > > i started working with the app engine some days ago, and now i > want to > > > > > > save some binary data (pdf, etc.) from my app (eg by clicking a > > > > > > button) in the storage system. > > > > > > > > anybody who can help me doing this? (tutorials, etc.) > > > > > > > > greatz > > > > > > flo > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- dream or truth -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
