Skip to content

Commit 327dacb

Browse files
committed
changing how the upload file works for v2, should test with a large file
1 parent f09bc65 commit 327dacb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pyclowder/api/v2/files.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ def upload_to_dataset(connector, client, datasetid, filepath, check_duplicate=Fa
318318

319319
if os.path.exists(filepath):
320320
filename = os.path.basename(filepath)
321-
m = MultipartEncoder(
322-
fields={'File': (filename, open(filepath, 'rb'))}
323-
)
324-
headers = {"X-API-KEY": client.key,
325-
'Content-Type': m.content_type}
326-
result = connector.post(url, data=m, headers=headers,
321+
# m = MultipartEncoder(
322+
# fields={'File': (filename, open(filepath, 'rb'))}
323+
# )
324+
file_data = {"file": open(filepath, 'rb')}
325+
headers = {"X-API-KEY": client.key}
326+
result = connector.post(url, files=file_data, headers=headers,
327327
verify=connector.ssl_verify if connector else True)
328328

329329
uploadedfileid = result.json()['id']

0 commit comments

Comments
 (0)