Search code examples
phpmaterialize

Audio files multiple upload not working with php


I created the PHP form below to send mp3 files to a database.

<form action="" method="post" id="audioForm" enctype="multipart/form-data">
    <div class="form-group">
        <div class="row audiosRow">
            <div class="col s12">
                <div class="file-field input-field">
                    <div class="btn btn-small">
                        <span>Track</span>
                        <input type="file" name="file-1">
                    </div>
                    <div class="file-path-wrapper">
                        <input class="file-path validate" type="text" placeholder="Upload audio files* (.mp3)" readonly="">
                    </div>
                </div>
            </div>
            <div class="col s12">
                <div class="file-field input-field">
                    <div class="btn btn-small">
                        <span>Track</span>
                        <input type="file" name="file-2">
                    </div>
                    <div class="file-path-wrapper">
                        <input class="file-path validate" type="text" placeholder="Upload audio files* (.mp3)" readonly="">
                    </div>
                </div>
            </div>
            <div class="col s12">
                <div class="file-field input-field">
                    <div class="btn btn-small">
                        <span>Track</span>
                        <input type="file" name="file-3">
                    </div>
                    <div class="file-path-wrapper">
                        <input class="file-path validate" type="text" placeholder="Upload audio files* (.mp3)" readonly="">
                    </div>
                </div>
            </div>
            <div class="col s12">
                <div class="file-field input-field">
                    <div class="btn btn-small">
                        <span>Track</span>
                        <input type="file" name="file-4">
                    </div>
                    <div class="file-path-wrapper">
                        <input class="file-path validate" type="text" placeholder="Upload audio files* (.mp3)" readonly="">
                    </div>
                </div>
            </div>
            <div class="col s12">
                <div class="file-field input-field">
                    <div class="btn btn-small">
                        <span>Track</span>
                        <input type="file" name="file-5">
                    </div>
                    <div class="file-path-wrapper">
                        <input class="file-path validate" type="text" placeholder="Upload audio files* (.mp3)" readonly="">
                    </div>
                </div>
            </div>
            <div class="col s12">
                <button class="btn btn-small" type="submit" name="submit">Save</button>
            </div>
        </div>
    </div>
</form>

The form works fine when I send images, but when I send audio files, it doesn't work with three or more. When I make a var_dump($_FILES) it displays array(0){}.

So I think it's probably a limitation, but I don't see that anywhere. I checked the php.ini configuration file, I have upload_max_filesize = 200M and max_file_uploads = 20.

So where can the problem be? Please help me.


Solution

  • I just saw where the problem was. post_max_size was limited to 8. It had to be reduced to 0 post_max_size=0 to make it unlimited. See the php documentation