Reputation: 109
before upload i will urlencode the filename, so my url is
https://xxx-my.sharepoint.com/_api/v2.0/drive/items/root:/test+test.txt:/content when i upload a file named test test.txt
but this API isn't deal with this.
onedrive api: https://api.onedrive.com/v1.0/drive/items/root:/test+test.txt:/content can run correctly
how can i keep the accurate file name with PHP
Upvotes: 1
Views: 1458
Reputation: 64
Office is slowly turning into Google Drive's retarded cousin. Sharepoint or Onedrive doesn't accept spaces or other characters.
Upvotes: -1
Reputation: 4202
+
is a tricky character in so far as being an encoded form of space. I believe it's technically only legal in the query string, and the expected way to encode the space in the path component is using %20
. You'll get the same behavior from both consumer and business if you use the percent encoded version, while as you've found out the + encoding only works as you desire for consumer (although whether it should is obviously debatable).
Upvotes: 0