Jump to content

upload_failure InvalidArgumentException(0)


Go to solution Solved by annedi,

Recommended Posts

We can't figure this one out. The error occurs sometimes when a member attempts to upload an image. I just tested uploading images and could not trigger the error.

Here's one example from the System Log

07/20/2023 01:37 PM upload_failure InvalidArgumentException (0)

#0 /home3/ultravio/public_html/content/system/File/File.php(326): IPS\_Image::create('')
#1 /home3/ultravio/public_html/content/system/File/File.php(436): IPS\_File::create('core_Attachment', '20190624_Rothen...', '', NULL, false, NULL, true)
#2 /home3/ultravio/public_html/content/system/Helpers/Form/Upload.php(755): IPS\_File::createFromUploads('core_Attachment', NULL, NULL, NULL, NULL, 0, Object(Closure), NULL, true)
#3 /home3/ultravio/public_html/content/system/Helpers/Form/Upload.php(309): IPS\Helpers\Form\_Upload->processUploads()
#4 /home3/ultravio/public_html/content/system/Helpers/Form/Editor.php(766): IPS\Helpers\Form\_Upload->__construct('topic_comment_5...', Array, false, Array)
#5 /home3/ultravio/public_html/content/system/Helpers/Form/Editor.php(185): IPS\Helpers\Form\_Editor->getUploader('topic_comment_5...')
#6 /home3/ultravio/public_html/content/system/Content/Item.php(5072): IPS\Helpers\Form\_Editor->__construct('topic_comment_5...', NULL, true, Array, Object(Closure))
#7 /home3/ultravio/public_html/content/system/Content/Item.php(4749): IPS\Content\_Item->commentFormElements()
#8 /home3/ultravio/public_html/content/system/Theme/Theme.php(885) : eval()'d code(5312): IPS\Content\_Item->commentForm()
#9 /home3/ultravio/public_html/content/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_forums_front_topics->topic(Object(IPS\forums\Topic), Array, NULL, Array, true, NULL, Array)
#10 /home3/ultravio/public_html/content/applications/forums/modules/front/forums/topic.php(611): IPS\Theme\_SandboxedTemplate->__call('topic', Array)
#11 /home3/ultravio/public_html/content/system/Dispatcher/Controller.php(118): IPS\forums\modules\front\forums\_topic->manage()
#12 /home3/ultravio/public_html/content/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#13 /home3/ultravio/public_html/content/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute()
#14 /home3/ultravio/public_html/content/system/Dispatcher/Dispatcher.php(153): IPS\forums\modules\front\forums\_topic->execute()
#15 /home3/ultravio/public_html/content/index.php(13): IPS\_Dispatcher->run()
#16 {main}

 

Link to comment
Share on other sites

It was a member's jpg image. I cannot supply that particular image because it did not upload and the member gave up. 

I tried uploading a jpg, jpeg, bmp and gif with no problems. I'm wondering if there was some kind of "traffic" problem at that particular time?

((I've learned so much about running a website from this forum. Nice.))

Link to comment
Share on other sites

Could unusual characters in a filename cause an upload problem? I have warned against this in the past. I tested some uploads of files named like DSC+-#$%.jpg and had no problem. I did not test every possible unusual character.

Link to comment
Share on other sites

I just now was able to induce an image upload_failure. I tried to upload a JPG image from a Bushnell Trail Cam. It was a 2.6MB file with pixel dimensions 1888x1062.

And, as you can see, that image file uploaded quite nicely here. 

Could contain: Animal, Mammal, Rat, Rodent, Pebble, Road, Plant, Fox, Kit Fox, Wildlife

 

So I'm thinking that I have either a server problem (but why I cannot guess) or some kind of configuration problem. I have looked at our settings thru Admin and see that I have no restrictions on size of image uploads. So I'm still baffled why this image uploads here but not on my forum.

Link to comment
Share on other sites

Would guess by it being an empty file that the file either was not passed along or intercepted. If you have CloudFlare or something sitting in front, you would want to try disabling that. Also, if you have any third party applications/plugins/themes, disabling those will also help rule them out from causing an issue here.

Link to comment
Share on other sites

Yes, perhaps we should set limits on image dimensions and file size, but the fact is that we do not have that restriction in place.

However I have discovered that when the image dimensions are larger than a max 1400 pixels, we get an upload error. Where is that being enforced? In the past we have had successful uploads of images larger than 1400 pix maximum width. It's not making sense to suddenly encounter a restriction on image size. 

Link to comment
Share on other sites

Here are some test results. They seem to be rather random. I am getting upload failures both when image dimension restrictions are in place and when they are not.

Image dimension maximum set to 1200 pixels.
1) Upload 7360 x 4912 JPG. Success. Resized to 1200 px width.
2) Upload 7360 x 4912 JPG. FAIL.
3) Upload 2551 x 2099 JPG. Success. Resized to 1200 px width.
4) Upload 5504 x 5504 JPG. FAIL.

Image dimensions unrestricted.
1) Upload 1400 x 934 JPG. Success.
2) Upload 7360 x 4912 JPG. FAIL.
3) Upload 3680 x 2456 PNG. Success.
4) Upload 1600 x 812 JPG. Success.
5) Upload 1998 x 1416. Success.

 

We have no 3rd party apps. We do not have CloudFlare.

Edited by annedi
Link to comment
Share on other sites

Changing the ImageMagick setting did not help.

Here are some recent upload test results. If there a pattern here, I cannot find it.

JPG, 1400 x 932 px. SUCCESS.
JPG, 1500 x 758 px. SUCCESS.
JPG, 1500 x 1000 px. FAIL.


JPG, 1800 x 1200 px. FAIL.
PNG, 1800 x 1200 px. SUCCESS.

JPG, 2000 x 500 px. SUCCESS
JPG, 500 x 2000. SUCCESS.


JPG, square, 1400 x 1400.  FAIL.
JPG, square, 1800 x 1800. SUCCESS.

Link to comment
Share on other sites

Switching to GD seems to cure the problem. Whew....I really really hope that turns out to be true. But I need to run with GD for a couple of days to be sure. 

Why in the world would ImageMagick "suddenly" start causing problems? Could it have anything to do with upgrading to PHP 8.whatever?

Link to comment
Share on other sites

Switching to GD seems to cure the problem. Whew....I really really hope that turns out to be true. But I need to run with GD for a couple of days to be sure. 

Why in the world would ImageMagick "suddenly" start causing problems? Could it have anything to do with upgrading to PHP 8.2.8?

Link to comment
Share on other sites

My error:  Our host server is running PHP 8.2.8. The forum software, however, is using PHP 8.1.21. I went to look up PHP versions and cited the wrong one above. Pls excuse me! (It was late.)

Anyway, ImageMagick is having problems under PHP 8.1.21 for our website. The switch to GD seems to be working. Shouldn't they both be usable with 8.1.21?

 

Link to comment
Share on other sites

  • Solution

OK, I think it has all come together now. I'll summarize so that a solution can be declared.

My website began to have sporadic image JPG upload failures. I couldn't completely correlate upload failures with image dimensions or file size, although upload failure did affect mostly large dimension JPGs. We had no problem with PNG uploads of any size.

We had been using ImageMagick all along. Lowering the ImageMagick quality setting did not fix the problem. Marc suggested switching to GD. That stopped the JPG upload failures. 

Thinking back, I realized that the upload failures began after the change to PHP 8.1.21. Randy suggested that the host might have missed setting some flag/option to ensure ImageMagick ran properly with PHP 8.1.21. So, as Marc suggested, I will ask my host to fix this PHP/ImageMagick incompatibility.

Thanks to SeNior-, Randy, Jim M and Marc for their useful suggestions and help. 😃

Edited by annedi
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...