如何使用AJAX将图像上传到谷歌云存储?

时间:2020-12-20 20:18:43

I'm new to Python Development, so in your answer please consider to not leave out things you may consider obvious. (I'm used to PHP development)

我是Python开发的新手,所以在您的回答中请考虑不要遗漏您可能认为显而易见的东西。(我习惯了PHP开发)

Here's the process I want to do:
- Allow user to use file picker and upload image(s) to a remote server using AJAX
- Convert image to blob value
- Store image ID on remote server database

下面是我想要做的过程:-允许用户使用文件选择器并使用AJAX将图像上传到远程服务器——将图像转换为blob值——在远程服务器数据库上存储图像ID

Pitfalls:
- I will be receiving images with multiple file encodings, (jpg, png)

缺陷:-我将接收具有多个文件编码的图像(jpg, png)

My question(s) is(are) am I thinking about this problem correctly? Is this the normal order and standard practice for this problem? - Would it be better to upload to google app engine instead? Would that change the way I needed to authenticate?

我的问题是我是否正确地思考了这个问题?这是这个问题的正常顺序和标准实践吗?-上传至谷歌app引擎会更好吗?这会改变我认证的方式吗?

2 个解决方案

#1


3  

Well, this kind of question is quite general and a complete answer would be quite lengthy. There is an open source problem forked from the "famous" gae-init framework, gae-init-upload which demonstrates the upload and store process with Ajax and Google App Engine as a back end. You can fork the repository and play around with it. You can also play with demo.

嗯,这类问题很一般,完整的答案会很长。有一个开源问题来自于“著名”的gae-init框架,gae-init-upload,演示了Ajax和谷歌应用引擎作为后端的上传和存储过程。您可以分叉存储库并使用它。你也可以玩演示。

#2


0  

Jquery-file-upload might be what you are looking for, it is a jQuery plugin which allows the user to select files, and then displays a progress bar as the files upload via ajax.

jQuery -file-upload可能是你要找的,它是一个jQuery插件,允许用户选择文件,然后显示一个进度条作为文件通过ajax上传。

It is fairly easy to integrate with gae, more info here: https://github.com/blueimp/jQuery-File-Upload/wiki/Google-App-Engine.

与gae集成是相当容易的,这里有更多的信息:https://github.com/blueimp/jQuery-File-Upload/wiki/Google-App-Engine。

It looks to me, like you are tackling the problem well. I have used gae to store images, and due to it's cloud nature, found it very fast for both storing and retrieving images.

在我看来,你很好地解决了这个问题。我已经使用gae存储图像,由于它的云性质,在存储和检索图像时发现它非常快。

#1


3  

Well, this kind of question is quite general and a complete answer would be quite lengthy. There is an open source problem forked from the "famous" gae-init framework, gae-init-upload which demonstrates the upload and store process with Ajax and Google App Engine as a back end. You can fork the repository and play around with it. You can also play with demo.

嗯,这类问题很一般,完整的答案会很长。有一个开源问题来自于“著名”的gae-init框架,gae-init-upload,演示了Ajax和谷歌应用引擎作为后端的上传和存储过程。您可以分叉存储库并使用它。你也可以玩演示。

#2


0  

Jquery-file-upload might be what you are looking for, it is a jQuery plugin which allows the user to select files, and then displays a progress bar as the files upload via ajax.

jQuery -file-upload可能是你要找的,它是一个jQuery插件,允许用户选择文件,然后显示一个进度条作为文件通过ajax上传。

It is fairly easy to integrate with gae, more info here: https://github.com/blueimp/jQuery-File-Upload/wiki/Google-App-Engine.

与gae集成是相当容易的,这里有更多的信息:https://github.com/blueimp/jQuery-File-Upload/wiki/Google-App-Engine。

It looks to me, like you are tackling the problem well. I have used gae to store images, and due to it's cloud nature, found it very fast for both storing and retrieving images.

在我看来,你很好地解决了这个问题。我已经使用gae存储图像,由于它的云性质,在存储和检索图像时发现它非常快。