File Upload Error - a non well formed numeric value encountered


#1

Hi all,

on my windows server I get following error at uploading a file (no matter if it´s an image or document).

a non well formed numeric value encountered

I am using the starterkit without any modifications.
On my Mac running MAMP everything is working fine.

Hope anyone can help me.
Thanks!


#2

Can you please provide some more information about your Windows setup (PHP version, server, XAMPP? etc) and your Kirby version? I know there were problems in the past with uploading images on Windows due to some mime type detection problems but I can’t recall having seen this error message before.

Is the image uploaded despite the message?


#3

Hi, thanks for your reply.
I found out the issue. My file size was too big (in my php.ini file I declared 2MB, but the file has 4MB).

Just strange with the error message.
I just took a look in the source code and found out following:

In the file kirby/vendor/getkirby/toolkit/lib/upload.php in line 193 it throws an exception ($messages = $this->messages()).
For me the function messages() looks good, it just returns a normal array with some error messages.
So instead of throwing the error with the correct error message, it throws the message “a non well formed numeric value encountered”.

Maybe it´s windows related?
My server is running with PHP 7.1.5 under FastCGI mode.
Maybe some of you Pro´s can find out why the function is throwing an exception only at windows.

Thanks!
Alex


#4

Yeah, strange, we should to look into this.


#5

Same problem on a friend’s website being hosted on GoDaddy Linux env.

Had to set a bigger upload file limit, problem solved.


#6

where did you find the ‘upload file limit’ part? I’ve tried to change the max file size value but no luck.


#7

@JessePimenta Which ones have you tried?

  • upload_max_filesize
  • post_max_size

#8

Thanks for pointing me here – i tried changing the ‘ERROR_MAX_FILE_SIZE’ in upload.php, but not this one.

Is there a recommended size? and where would i dictate that?


#9

Depends on what you want to upload, and if there are any restrictions from your hosting provider.

Recommendations:

  • upload_max_filesize <= post_max_size
  • post_max_size <= memory_limit

This is done in your php.ini. Check the current values and increase as required.

http://php.net/manual/en/ini.core.php#ini.post-max-size


#10

Thank you for the guidance.
A bit of a php beginner here, so I appreciate the help

I found the php.ini in my local mamp environment and changed the value of the max file size, but cant find the php.ini file anywhere in my remote directory hosted on godaddy. Site still running smoothly…if i just go ahead and copy the file to the live site, which directory should the php.ini file live in within my public_html folder?

(apologies if this is an extremely simple question)


#11

Check out their docs, don’t know what sort of hosting you have: https://www.godaddy.com/help/change-php-settings-26379. Follow the links where necessary.

Don’t just copy a file from one server to the next. Mamp’s php.ini does have Mamp-specific settings that are not useful in other environments.


#12

are you on go daddy?

https://www.godaddy.com/help/php-upload-limits-on-shared-hosting-1475


#13

Thank you! Will take you recommendation and make sure i’m not importing unnecessary files from MAMP.