I went to experiment with the Assistant API but I doesn’t seem to be allowing php files which , when I attempt to upload I get:
“There was an error uploading the file helpers.php: Invalid file format. Supported formats: [‘c’, ‘cpp’, ‘csv’, ‘docx’, ‘html’, ‘java’, ‘json’, ‘md’, ‘pdf’, ‘php’, ‘pptx’, ‘py’, ‘rb’, ‘tex’, ‘txt’, ‘css’, ‘jpeg’, ‘jpg’, ‘js’, ‘gif’, ‘png’, ‘tar’, ‘ts’, ‘xlsx’, ‘xml’, ‘zip’]”
As you’ll see php is in the list of supported formats.
2 Likes
I did some more digging into this issue. It seems to be MIME-type related. Some files I try to upload get accepted (views basically) while others, like Controllers are not.
The MIME type for the ones that get accepted is text/html, while the MIME for the ones that don’t is text/x-php.
I did some test to see what MIME type would be returned which in my tests it does return: text/x-php
I found that removing the opening and closing PHP tags resolved this. It was able to properly understand the contents of the file afterwards.
1 Like
Thank you @NullApps! Dropping the <?php & ?> tags worked like a charm! This explains why only the views were accepted by the assitants.