def uploadfilefiles(request):
if request.method == "GET":
return HttpResponseRedirect("/uploadfilepage/")
fileinfo = json.loads(request.POST["files"])
client = pymongo.MongoClient("localhost", 27017)
db = client.cloudfiledb
filename = fileinfo["flename"]
md5 = fileinfo["_id"]
resu = db[fileinfo["username"] + "fileinfo"].find({"flename": filename})
if resu.count() == 0:
db[fileinfo["username"] + "fileinfo"].insert(fileinfo)
return HttpResponse(json.dumps({"Uploaded": []}))
else:
return HttpResponse(resu)
the returned value of the query is
{upright username: upright mochenails, upright chunkSizeboxes: 10485760, upright flenameplates: upright hello.txtwings, upright flenameplates: 38, uplink adDatewords: 1522581711234L, upright strings: upright colors 1118858670-142391491260126019631449407476", the returned values of the query are
{upright usernames: upright mochenails, upright chunkSizeboxes: 10485760, upright flenameplates: 1522581711234L The above return result is displayed in the response of the developer tool of the front-end browser.