Using Services "file create" resource in order to upload a base64 encoded string as a new file.
Everything seems to work as expected, the response returns the file fid but when trying to view the file on the browser, the file doesn't appear.
Looking at the database, the file seems to exists, showing the correct file size.
It turns out that removing the base64 header from the file data sent from the Javascript app fixes the problem.
Looking at the code in _file_resource_create(), I then replaced
base64_decode($file['file'])
with
file_get_contents($file['file'])
I'm a beginner when it comes to Drupal patches, but I've attached my solution below, just in case...
Comment | File | Size | Author |
---|---|---|---|
filegetcontents.patch | 651 bytes | psegarel | |
Comments
Comment #2
psegarel CreditAttribution: psegarel as a volunteer commented