Jump to content

Encoding an array of objects in x-www-form-urlencoded encoding?


Josh
 Share

Go to solution Solved by Josh,

Recommended Posts

I have never tried to do this. The system is detecting the files[0] part, and the "Hello!" contents, but the file name MyFile.txt is not being interpreted correctly. The docs say that files is supposed to be an array with objects that have a key for the filename and a value for the contents of the file.

Do you see any problem?

std::string options = "category=97&description=MyDescription&title=FileName&author=1&";
options += urlEncode("files[0].MyFile.txt") + "=" + urlEncode("Hello!");
auto j3 = InvisionPower::APIPost("/downloads/files/", token, options);

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

The problem was that files is an object, not an array. So it is supposed to be like this:
files[filename]=filecontents

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...