Html表单通过应用引擎提交数据存储实体和blobstore [英] Html form submit both datastore entity and blobstore through app engine

查看:100
本文介绍了Html表单通过应用引擎提交数据存储实体和blobstore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个上传文件的jsp文件。我添加了一个名称和电子邮件表单。我希望能够跟踪哪个blob上传到我的应用引擎blobstore是来自哪个人。我需要绑定数据存储来获取联系信息吗?这通常如何完成?目前我可以通过类型,文件名,大小和创建时间过滤blob查看器?我可以在常规数据存储中添加更多条目吗?

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?

我想同时提交数据存储信息和文件。可以在html表单中列出多个操作命令。我对html的了解甚少。

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>


推荐答案

您的上传表单代码似乎是正确的,但您仍然可以需要编写单独文件中的上传处理程序代码。

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

您应该将firstname,lastname,email和blobkey存储到数据存储中。

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

完整的文档和示例可在此处找到:
https://developers.google.com/appengine/docs/java/blobstore/

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

这篇关于Html表单通过应用引擎提交数据存储实体和blobstore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆