Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eriktobben's avatar

Problem with uploading larger files

Hi!

I am having problems with uploading a file (4,3 MB). I have edited Forge config to 50MB. Here is the code:

if ($request->hasFile('file'))
      {

        $file = $request->file('file');
        $filetype = $file->guessExtension();
        $filename = 'upload-' . uniqid()  . '.' . $filetype;

        // Store the file
        $file->move(storage_path() . '/app/', $filename);

        // Store file information in database.
        File::create([
          'type' => 6,
          'filetype' => $filetype,
      'filename' => $filename,
          ]);

        session()->flash('message', 'File saved');
        return redirect()->action('FileUploadController@index');

      } else {
        session()->flash('message_error', 'No file selected!');
        return back()->withInput();
      }

I am getting the error "No file selected!". I have no problem uploading smaller files.

I am hoping someone can help me here :)

0 likes
3 replies
uxweb's avatar

@eriktobben

Hi Eric, are setting the request form like this?

<form method="POST" action="/files" enctype="multipart/form-data" accept-charset="UTF-8">

To upload files the enctype="multipart/form-data" attribute must be set :).

eriktobben's avatar

@uxweb

Yes, it is. I have no problems uploading smaller files. But I think I have found the problem. When logging in to the server, I see that the disk space is 94% full. I just tried to upgrade it, and it seems to be working.

Does anyone know if there are any temp files/folders I can delete to free up space on a server?

ohffs's avatar

Check your storage/logs/laravel.log isn't getting huge :-) You can quickly see which directories are using space using du - for instance :

cd /var/www/html/
du -sm * | sort -nk1
du -sm */* | sort -nk1

Please or to participate in this conversation.