What is the curl command to upload a list of files from an input form in flask?

user956424

I need the curl command to upload a list of files from a form file input field. What I have tried:

curl -b cookies.txt -X POST http://localhost:8081/rt/api/v1.0/add -d '{"title":"Website updated", "description": "Not accessible", "requestor":"[email protected]", "mfiles":["file1.txt","file2.txt"]}' -H 'Content-type:Application/json'

The api to upload the files:

  for f in request.files.getlist('mfiles'):
        filename = secure_filename(f.filename)
        f.save(os.path.join(upload_folder, filename))

This gives me error: Statement is not an insert() expression construct.

What is the exact curl to do so? I am using Flask 0.12, python 2.7

user956424

@Boris, Yes. I should have used an input form. And the curl used to upload multiple files is:

curl -b cookies.txt -X POST http://localhost:8081/rt/api/v1.0/add -F "title=some title MM" -F "description=Not accessible" -F "[email protected]" -F "[email protected]" -F "[email protected]"  

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Command-line cURL submit form from other files

curl upload all files in a directory with a single curl command?

How to upload multiple files from HTML form, using PHP "SWITCH" function with more than one input file?

How to upload files from two html input fields in the same form using php?

curl command not accepting input from file

Get $_FILES from curl without HTML form

What is the curl command line to send this HTTP Post to Cakephp to upload a file?

Use files from ALM as input for upload test

codeigniter upload files from multiple input

curl command to upload data from a file to couchbase bucket

Upload files from a list via ftp in bash

How to upload all the files from local to host using Curl?

Image upload CURL command to PHP Curl

cURL command to upload file does not upload file

What is the windows cmd prompt command to -> List 'n' file names in console from a directory having 100 files

How to form a linked list from input in Pascal?

Codeignitor multiple input file upload from a dynamic form

upload photo and text from form input and sending to telegram bot with php

How to download files from command line in Windows like wget or curl

How to upload files from form to server and store in a new folder

How to upload files to server from html form using python cgi

upload multiple files from a form react js throgh axios

Batch command to delete files from file list

How to upload files to different subdirectory using PHP via cURL on Linux command line?

Unable to upload files with Flask on Heroku

How to add/upload/choose multiple files from one input tag?

Tar archiving that takes input from a list of files

What does * means in the list from the ls command?

Provide input file to CURL command