python - File upload chokes with 100-continue sometimes -


i call web service using curl upload image server. works , @ other times, haults @ point shown below. dehavior inconsistent - manage image uploaded , response, while @ other times sit there shown below. missing/doing wrong?

code snippet:

filename = str(id) + '.' + str(int(time.time())) + '.' +  secure_filename(file.filename) filename_absolute = os.path.join(app.config['upload_folder'], picture_type, filename) file.save(filename_absolute) 

sample call [success]:

curl -v -f "id=1" -f 'file=@/tmp/2.png' -f 'picture_type=user' http://host:5000/api/v1/upload-picture *   trying 45.76.12.43... * connected host (host) port 5000 (#0) > post /api/v1/upload-picture http/1.1 > host: host:5000 > user-agent: curl/7.47.0 > accept: */* > content-length: 154309 > expect: 100-continue > content-type: multipart/form-data; boundary=------------------------7cc65a2371111afb >  < http/1.1 100 continue * http 1.0, assume close after body < http/1.0 200 ok < content-type: application/json < content-length: 136 < server: werkzeug/0.9.4 python/2.7.6 < date: fri, 18 aug 2017 07:16:00 gmt <  {   "data": {     "link": "host:5000/api/v1/user/view-picture/1"   },    "error": 0,    "message": "file uploaded successfully" * closing connection 0 } 

sample call [fail]:

curl -v -f "id=1" -f 'file=@/tmp/2.png' -f 'picture_type=user' http://host:5000/api/v1/uplad-picture *   trying host... * connected host (host) port 5000 (#0) > post /api/v1/uplad-picture http/1.1 > host: host:5000 > user-agent: curl/7.47.0 > accept: */* > content-length: 154309 > expect: 100-continue > content-type: multipart/form-data; boundary=------------------------046a40f6e0480526 >  * done waiting 100-continue 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -