PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 10, 2022

[FIXED] stream_socket_sendto() error when trying to upload a pdf file

 February 10, 2022     laravel, laravel-5     No comments   

Issue

I am getting this error when uploading a pdf file, any ideas?:

RuntimeException stream_socket_sendto(): A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied

form in view:

<form action="{{ route('press-files.store') }}" method="POST" enctype="multipart/form-data">
    @csrf
    <input type="file" name="pressFiles[]" multiple="multiple">
    <button type="submit" class="btn btn-primary start">
    <i class="pe-upload"></i>
    <span>Start upload</span>
</form>

Controller:

public function store(Request $request)
{
    $press_files = $request->all();
    dd($press_files);
}

this is only happening on .pdf files - png's and jpegs all work.

Thanks for any help in advance


Solution

It turned out to be due to file size. I will keep this question and answer incase anybody else requires it.

The .pdf I was using was 2.8 MB and this failed, I used a much smaller file ~125kb and this worked fine.



Answered By - CodeBoyCode
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing