sezertunca's avatar

Larger than 2MB file uploads fails on forge

Hi,

I'm struggling with uploading files large than 2MB using forge, it works locally but not on forge.

I've updated the php.ini to increase post_max_file_size, upload_max_file_size and max_execution_time.

I've also updated client_max_body_size on nginx.

On Chrome I get the "The file field is required" error which looks like failing on the validation but works with smaller files. On Safari I get the MethodNotAllowed exception.

Any ideas?

Thanks,

Sezer

0 likes
6 replies
sezertunca's avatar

Hi Prez

Thanks, but unfortunately that hasn't worked.

Sezer

bashy's avatar

You can change the vars with commands if you want;

// php 5

// memory limit (I suggest 256M but use 128M if you have a small server)
sudo sed -i "s/\memory_limit = .*/memory_limit = 128M/" /etc/php5/fpm/php.ini

// post_max_size needs to be bigger than upload_max_filesize since other POST data is counted in the amount.
sudo sed -i "s/\post_max_size = .*/post_max_size = 125M/" /etc/php5/fpm/php.ini
// this is for file uploads
sudo sed -i "s/\upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php5/fpm/php.ini

// php 7

// memory limit (I suggest 256M but use 128M if you have a small server)
sudo sed -i "s/\memory_limit = .*/memory_limit = 128M/" /etc/php/7.0/fpm/php.ini

// post_max_size needs to be bigger than upload_max_filesize since other POST data is counted in the amount.
sudo sed -i "s/\post_max_size = .*/post_max_size = 125M/" /etc/php/7.0/fpm/php.ini
// this is for file uploads
sudo sed -i "s/\upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini

Sounds like you have a different issue though. Can you show some html form code?

sezertunca's avatar

Thanks bashy,

` File Upload

    <form id="fileUploadForm" action="/upload" class="dropzone">
              <div class="fallback">
                <input name="file" type="file" multiple />
              </div>
            </form>
        </div>

        </div>      
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.js"></script>
    <script>
        Dropzone.options.fileUploadForm = 
        {
            paramName: "file",
            maxFileSize: 125,
            acceptedFiles: '.zip'
        };
    </script>
</body>

`

bashy's avatar
bashy
Best Answer
Level 65

If you're uploading files, you need enctype="multipart/form-data"?

sezertunca's avatar

Thanks a lot for your help bashy.

It worked after adding the enctype.

Sezer

LewisCowles1986's avatar

Completely separate suggestion, I send up to 1MB chunks to the server using modern front-end, and if that doesn't work (through detecting availability) I simply notify the user that files > 1MB won't work. The benefits are that basically your UI looks a lot more responsive, and in tests we can upload more files with users client-side only sending partial data packets, assembling the file on the server.

I've heard some people are actually sending multiple chunks at once over separate requests, which would theoretically give a speed boost, but load your server.

Please or to participate in this conversation.