diff --git a/filestorage/api_views.py b/filestorage/api_views.py index 676dc88..332c61e 100644 --- a/filestorage/api_views.py +++ b/filestorage/api_views.py @@ -62,12 +62,12 @@ class RESTView(object): buf = infile.read(BLOCKSIZE) return hasher.hexdigest() - @view_config(request_method='PUT') - def put(self): + @view_config(request_method='POST') + def post(self): try: # Create a fresh uuid for the new file file_id = str(uuid.uuid4()) - # Use PUT /files to create a new file + # Use POST /files to create a new file input_file = self.request.POST['file'].file # Write the data into a temporary file temp_file_path = os.path.join(self.path_tmp, '%s' % file_id) + '~' diff --git a/filestorage/static/app.js b/filestorage/static/app.js index 4c48ec5..bf04324 100644 --- a/filestorage/static/app.js +++ b/filestorage/static/app.js @@ -13,7 +13,7 @@ $(document).ready(function() { contentType: false, processData: false, data: form_data, - type: 'PUT', + type: 'POST', success: function(response_text){ response = $.parseJSON(response_text); displayAttributes = ['uuid', 'key', 'name', 'size', 'create_utc', 'md5', 'sha1', 'sha256']; diff --git a/filestorage/templates/home.jinja2 b/filestorage/templates/home.jinja2 index d45b55a..cae12dc 100644 --- a/filestorage/templates/home.jinja2 +++ b/filestorage/templates/home.jinja2 @@ -11,11 +11,11 @@
This site enables users to upload files for temporary or permanent access. - Since the PUT method of the API is used to upload files, please enable javascript. + Since the POST method of the API is used to upload files, please enable javascript.
Use this command to upload a file using curl: -
curl -X PUT {{ request.route_url('files') }} -F "file=@/path/to/your/file"+
curl -X POST {{ request.route_url('files') }} -F "file=@/path/to/your/file"You will get a JSON response containing a bunch of checksums and a key. Take good care of it, as the key it is your only way to delete the file later! In order to delete a file, use this curl command: