Symfony2 File Upload with Related Entities

This is for a very old version of Symfony – 2.3

It might not work with the version of Symfony you’re using

Here is how I do it.

What it does? Upload an image file and an audio file and add an encode job.
The purpose is to join an image and a mp3 into a mkv file x264 encoded with ffmpeg.
But this here is only to upload the files and add the related entities. Yes I am very proud of myself for having accomplished this even if it was extremely more complicated than just doing it in PHP.
Continue reading “Symfony2 File Upload with Related Entities”

File Uploads in PHP and in Symfony2

If you’re looking for an example:
symfony2 file upload with related entities

The PHP way:



15 minutes later. Success.

The symfony2 way:
How to handle File Uploads with Doctrine
Multiple File Uploads with Symfony2
Syntax Error. Head Explodes. 3 days later, time wasted.

And this is why Symfony2 sucks.

Can you reuse the PHP way? Sure you can. It works for single and multiple uploads. It does not use the uploadprogress but neither does the Symfony2 way.
Adding a mime type check? About 4 lines of code.

Imho the Symfony2 developers should focus on creating a scripting language since they’re so hot about reinventing the wheel.

If you want to waste resources and increase costs when developing a project use Symfony2. Go ahead, I won’t stop you.
If you want to keep it slim and easy learn PHP or some other scripting language.
Simplicity always wins.

Example: C64 vs Amstrad/Schneider CPC 464, the CPC was superior in every aspect but the C64 was simpler to use. The C64 won.
Amiga vs Atari, Amiga -> simpler. Facebook vs Myspace. Facebook simple. Facebook also sucks but yeah you get the point.
Windows vs Linux. Windows just works aka simple therefore Windows is used on most workstations. New Macintosh vs Windows. Mac is easy and just works, easier than Windows. Mac Userbase grows. IOS vs Android. Personally I find Android is better but the IPhone also just works and is simple.