简体   繁体   English

如何使用Ajax将Blobstore图像存储在数据存储中?

[英]How to store blobstore images in the datastore using ajax?

I have a form which collects the Employee details. 我有一张收集员工详细信息的表格。 I have an option to upload the employee image. 我可以选择上传员工图片。 I need to store all these data in datastore through ajax. 我需要通过ajax将所有这些数据存储在数据存储中。 I am using Spring MVC to handle all the requests. 我正在使用Spring MVC处理所有请求。 I have tried the sample program given in appengine docs using form action. 我已经尝试过使用表单操作在appengine文档中提供的示例程序。 But how to do this operation with ajax? 但是如何使用ajax进行此操作? Thanks in advance... 提前致谢...

You asked your question in a very abstract manner, so here is your abstract answer: 您以非常抽象的方式提出了问题,因此这是您的抽象答案:

  1. Store the images in Blobstore or Google Cloud Storage 将图像存储在Blobstore或Google Cloud Storage中
  2. The other form elements will be passed as query params to the generated upload URL 其他表单元素将作为查询参数传递到生成的上载URL
  3. Once Blobstore/GCS is done processing the upload, it will send a request to the callback route you specified, and that request handler will see a request with all the original params from your form, including a file metadata object. Blobstore / GCS处理完上传文件后,它将向您指定的回调路由发送请求,并且该请求处理程序将看到包含表单中所有原始参数(包括文件元数据对象)的请求。
  4. If you want to know how to do a file upload with ajax instead of a form element, check the link provided by the other user in a comment. 如果您想知道如何使用ajax而不是表单元素来上载文件,请检查其他用户在注释中提供的链接。 You can also try google, to learn the particular syntax of sending file uploads from whichever ajax library you're using. 您也可以尝试使用google,以了解从所使用的任何ajax库发送文件上传的特定语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM