Html form submit both datastore entity and blobsto

2019-08-27 09:43发布

I've got this jsp file that uploads a file. I added a name and email form. I want to be able to keep track of which blob uploaded to my app engine blobstore is from which person. Would I have to tie the datastore to take the contact info? How is this usually done? Currently I can filter the blob viewer by type, filename, size, and creation time? Can I add more entries like I can with the regular datastore?

I want to submit both the datastore information and the file at the same time. Can multiple action commands be listed in the html form. I really know little about html. I would like to add the datastore service to the action.

<form action="<%= blobstoreService.createUploadUrl("/upload") %>" method="post" enctype="multipart/form-data">

First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname"><br>
email : <input type="text" name="email"><br>
email again: <input type="text" name="emailagain"><br>


    <input type="text" name="foo">


    <input type="file" name="myFile">
    <input type="submit" value="Submit">
</form>

1条回答
姐就是有狂的资本
2楼-- · 2019-08-27 09:54

Your upload form code seems correct, but you will still need to code the upload handler codes which is in separate file.

And you should probably store the firstname, lastname, email, and the blobkey to the datastore.

Complete documentation and example is available here: https://developers.google.com/appengine/docs/java/blobstore/

查看更多
登录 后发表回答