mushfique's avatar

How to reduce saving time when upload audio file in laravel

When I upload a audio file which is almost 10 mb or more it take too much time to save on the database.sometimes it take 15 minutes or more to save a audio file where file size is more than 50 mb. How to reduce saving time when upload any size of audio file or any suggestions to saving audio files quickly in database?

0 likes
14 replies
Sinnbeck's avatar

Save in the database? Are you saving the file itself in the database? Save the file on disk and store the path to the file in the database. After that the problem should be solved

1 like
mushfique's avatar

@Sinnbeck yes,I saved the file on disk and store the path to the file in the database. But it takes more time to save in my application.

1 like
Sinnbeck's avatar

@mushfique show the code. After the file is uploaded it should not take any time. Are you sure you are not just waiting for the file to upload?

1 like
mushfique's avatar

@Sinnbeck It makes me wait for 10 or 15 min for uploading audio file and after successfully uploaded the file I have played the audio file.

1 like
Sinnbeck's avatar

@mushfique so the upload is slow only? Is this on your dev environment or production?

1 like
mushfique's avatar

@Tray2 connection is absolutely okay.can you give me any idea or suggestions where large file will be uploaded quickly?

1 like
Tray2's avatar

@mushfique There is nothing to do if you have a shitty upload speed, it has nothing to do with laravel. If it's not you connection, it could be that your host is limiting the upload speed to the server.

1 like
Sinnbeck's avatar

@mushfique you still haven't shown the code you are using? Maybe there is some extra code that makes it slower

1 like
vincent15000's avatar

If you mean saving the file inside the database, it's not a good idea as said @sinnbeck.

If you mean that the upload is taking time, you can perhaps try the queues.

jlrdw's avatar

@mushfique okay but how about your connection speed because on most modern systems a 10 MB shouldn't take too long. 10 or 15 minutes sounds like you are using dial up instead of high speed.

1 like
martinbean's avatar

@mushfique You can’t magically make uploads go faster. If you could, then uploads would be faster.

How long it takes to upload depends on what size the file is, and the bandwidth of the user’s computer and the host’s server.

1 like

Please or to participate in this conversation.