Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid size provided for UploadedFile; must be an int. #10

Closed
weierophinney opened this issue Dec 31, 2019 · 4 comments
Closed

Invalid size provided for UploadedFile; must be an int. #10

weierophinney opened this issue Dec 31, 2019 · 4 comments

Comments

@weierophinney
Copy link
Member

Hi guys, I'm working on an iOS project and I'm required to send documents, such as pdfs, to my laravel server. The issue is, every time I try to send a post request for a PDF, I get this error message: Invalid size provided for UploadedFile; must be an int. I'm at my wit's end trying to solve this issue. Any ideas?


Originally posted by @ImmanuelKannan at zendframework/zend-diactoros#316

@weierophinney
Copy link
Member Author

That exception is thrown here https://github.com/zendframework/zend-diactoros/blob/167607290e79c396fd947cedeadccce0173c0e47/src/UploadedFile.php#L113-L115

That is all I can derive from the description, you need to be more specific. Stack traces, anything?


Originally posted by @Xerkus at zendframework/zend-diactoros#316 (comment)

@weierophinney
Copy link
Member Author

If laravel uses ServerRequestFactory to create request from php globals, try to do var_dump($_FILES); exit; with failing request and post result here


Originally posted by @Xerkus at zendframework/zend-diactoros#316 (comment)

@weierophinney
Copy link
Member Author

Increase upload_max_filesize in php.ini

;Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 16M

Then
Restart Apache


Originally posted by @mrnaghibi at zendframework/zend-diactoros#316 (comment)

@halfpastfouram
Copy link

While this error itself will no longer occur, almost the same problem still happens in 2.3.0. When receiving the uploaded files from a request:

Argument 2 passed to Laminas\Diactoros\UploadedFile::__construct() must be of the type integer, string given, called in src/functions/create_uploaded_file.php on line 38

This can be easily fixed in the code by casting both the file size and the error code as an integer. I'll be making an PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants