File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * jQuery File Upload Plugin GAE Go Example 3.1.0
2
+ * jQuery File Upload Plugin GAE Go Example 3.1.1
3
3
* https://github.com/blueimp/jQuery-File-Upload
4
4
*
5
5
* Copyright 2011, Sebastian Tschan
@@ -242,14 +242,23 @@ func delete(w http.ResponseWriter, r *http.Request) {
242
242
if len (parts ) != 3 {
243
243
return
244
244
}
245
+ result := make (map [string ]bool , 1 )
245
246
if key := parts [1 ]; key != "" {
246
247
c := appengine .NewContext (r )
247
248
blobKey := appengine .BlobKey (key )
248
249
err := blobstore .Delete (c , blobKey )
249
250
check (err )
250
251
err = image .DeleteServingURL (c , blobKey )
251
252
check (err )
253
+ result [key ] = true
252
254
}
255
+ jsonType := "application/json"
256
+ if strings .Index (r .Header .Get ("Accept" ), jsonType ) != - 1 {
257
+ w .Header ().Set ("Content-Type" , jsonType )
258
+ }
259
+ b , err := json .Marshal (result )
260
+ check (err )
261
+ fmt .Fprintln (w , string (b ))
253
262
}
254
263
255
264
func handle (w http.ResponseWriter , r * http.Request ) {
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
#
3
- # jQuery File Upload Plugin GAE Python Example 2.1.0
3
+ # jQuery File Upload Plugin GAE Python Example 2.1.1
4
4
# https://github.com/blueimp/jQuery-File-Upload
5
5
#
6
6
# Copyright 2011, Sebastian Tschan
@@ -141,7 +141,12 @@ def post(self):
141
141
self .response .write (s )
142
142
143
143
def delete (self ):
144
- blobstore .delete (self .request .get ('key' ) or '' )
144
+ key = self .request .get ('key' ) or ''
145
+ blobstore .delete (key )
146
+ s = json .dumps ({key : True }, separators = (',' , ':' ))
147
+ if 'application/json' in self .request .headers .get ('Accept' ):
148
+ self .response .headers ['Content-Type' ] = 'application/json'
149
+ self .response .write (s )
145
150
146
151
147
152
class DownloadHandler (blobstore_handlers .BlobstoreDownloadHandler ):
You can’t perform that action at this time.
0 commit comments