Error uploading Dalle image into WordPress

Hi there,

I have created a scenario where i generate a Dalle image after which i want to upload it into the WordPress media library. It succeeds 30% of the time so i know my settings are correct. But the other times it fails with this error:

HANDLED ERROR

  • type

RuntimeError

  • message

[500] The uploaded file exceeds the upload_max_filesize directive in php.ini. (error code: rest_upload_unknown_error)

I have checked my max upload setting in WordPress and it is set to 128MB so should be enough for an image

image

Any ideas?

This is different from the upload_max_filesize setting on the server. You need to make changes to php.ini file itself, not from Wordpress.

upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300
2 Likes

On the error’d executions of the scenario have you looked into the Make log to see the size of the image DALLE is generating? One way to do that is to add a module to calculate the length() of the binary image inside your scenario and calculate the # of MB it is. I guess it is possible it is exceeding the maximum size of 128MB. That’s a stretch but you have to rule that out first just in case.

What else may be happening is that the maximum time to respond to a request on the WordPress server may be timing out too, and the error coming back may be a red herring. A 500 error can be from a variety of issues on WordPress. Check out the php.ini directives that can be set especially the

max_execution_time = 60

This is set in seconds. It may need to be larger.

2 Likes

Thanks both!

I could not find a php.ini file on my server so I created one in the WordPress root (where the wp-admin, wp-content etc folders are) with the following content:

upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300

The output in Make.com of the image generation shows this e.g.:

image

So an output file of about 5MB.

The error is still there though when trying to upload it into WordPress.

Is this not the right location for the php.ini?

These are my new WordPress settings according to the Health section:

What does your Wordpress module for uploading image look like? What is the format for the image you are sending into that module ?

2 Likes

Sending the image format:


Hey @Alex_Reijnierse

I was experiencing the same problem. I resolved it by adding the HTTP module ‘Download a file’ after ChatGPT and mapped the output of the HTTP module in WordPress

3 Likes

Yeah I was wondering if the binary image data that you’re mapping into WordPress will be properly processed as an image file. Downloading it into Make could make the image native to Make and processable by the WordPress app.

It does not make a difference I am afraid. Still errors out most of the time (not all the time) with the upload size limit.

image

image

It must be something in the WordPress upload module i guess?

@Alex_Reijnierse

map like this

1 Like

Tried that but then it outputs file.png as filename for all three images i want to upload resulting in 3 identical images?

I figured it out.

I had ChatGPT generate an image caption that I was also using for the image filename to store in WordPress.

It turned out that ChatGPT3.5 introduced special characters in the caption text like ":, etc which were not allowed as filenames in WordPress even after I specifically asked it not to use these special characters.

After I switched to ChatGPT4 for this task the problem was gone and all files are being uploaded successfully.

The error message from Make.com about the file size limit threw me off. IT was never about the file size but an incorrect filename.

Thanks for the support all!

3 Likes

That was an error coming back from the WordPress API but maybe it was giving the wrong information back due to the weird file name. That’s entirely possible. Glad you figured it out – sometimes it’s those side effect things so you have to eliminate all the possible things including the filename format.

The 30% success rate was a clue. It could not have been doing that if the image generation was creating small-ish images. The 70% failure rate was based on faulty image names which were being passed, failing and WordPress was returning an error 500 with the wrong error message.

2 Likes