Cant upload images with an api request
Hi, i cant upload images/fal with an api call. I make everything like in the docs described but nothing worked. Without images the call works perfectly. I got the follow error if i try to upload an image.
BTW: is it possible that you share an working example extension with an image/fal upload?
Comments (8)
-
-
Thanks for reporting. Probably has to do with your database settings. It tries to write an empty string in a field that should be an int (which I will correct in the next update). Depending on the database-settings, this will not throw an error and automatically convert it to a “0”. (https://stackoverflow.com/questions/28606483/how-to-allow-empty-string-for-integer-in-mysql)
Lots of updates coming in a few days. Have a look at the commits for nnrestapi and nnhelpers :)
Quick fix could be:Look for the method
fromFile
inNng\Nnhelpers\Utilities\Fal
. You will see an$entry
array.
Add this line to the array and see if it works:
'uid_foreign' => 0,
One more thing which is not documented correctly in the current version: You MUST have the
@Api\Upload("...")
Annotation set – otherwise the files will not get moved from the/tmp
folder to your destination folder:https://docs.typo3.org/p/nng/nnrestapi/main/en-us/Annotations/Annotations/60_Upload.html
-
Your solution
'uid_foreign' => 0,
Not working either, It shows “Field 'files' doesn't have a default value” even after selecting file.Also, if you put configuration into LocalConfiguration.php it does not throw error. But, database entry will be null
'initCommands' => 'SET SESSION sql_mode=\\'\\'',
-
Could you provide some more details (which PHP-Version, which database etc.?)
-
Hi David,
I have composer setup with ddev and versions are below:
- TYPO3 12 LTS
- EXT:headless 4.1.1
- EXT:nnrestapi 2.0.3
Thank you!
-
@GNBhava
You forgot to mention PHP-version and database information (Maria, MySQL - version?). -
Hi Stig,
Im using PHP version 8.2 and mariadb version 10.4.
Thank you!
-
- changed status to closed
Should be fixed with latest EXT:nnrestapi and EXT:nnhelpers
- Log in to comment
Confirming issue, Im having same issue with TYPO3 v12