Symfony 2.2 - upload files - php

I am new in SYmfony and going to make a blog service with symfony2. I want to let user upload a picture and show it On his/her post. what should I do?

Use dustin10/VichUploaderBundle.
Instructions on how to use the bundle can be found in the documentation.
Further information can be found in the cookbook chapter How to handle File Uploads with Doctrine but VichUploaderBundle is the easiest way to get you started.
For image processing have a look at LiipImagineBundle.

Related

Laravel - Vue chunk upload - Frontend and Backend example

I use Laravel 5.5 and I tried to use Pion chunk upload to upload large files. I followed the steps and I think backend should work. The problem is that I am unable to make work the frontend uploader. I want to use a vue component for this task and I tried several of them, but the most promising was the Simple Uploader.
Can someone show me a full example of these two working together?

Attaching files to comments with Symfony

How can I add attach files to comments in Symfony ?
So far I was using FOSCommentBundle but I doubt I can easly add the attach files feature.
Is there a bundle which does that or do I have to code it from scratch by myself ?
Well, you could override FOSCommentBundle to make it handle files.
There are a lot of bundle to help managing media SonataMediaBundle is one of them.
Otherwise you can check on packagist for some bundle which already handle this.

Add Captcha Image to laravel App without installing any package

I already uploaded a laravel app and my boss wants me to add a captcha image to the website, now I researched a lot of captcha techniques for laravel and it all requires me to install a package, the problem is I dont want to reupload the website. Any solutions on this?
No matter what you do, you're going to need to write code and upload it.
Yes there exists a way using php library in laravel without using composer http://www.onlinekurukshetra.com/using-captcha-in-laravel-without-composer/ works fine for me.
Also custom validation using laravel for validating the captcha is there. But Need a way validate it client side. Think you have to made custom code for it.

Symfony 2 MediaBundle file upload tutorial wanted, how to start?

I'm new with Symfony and MediaBundle, can't find tutorial how to upload files to server using MediaBundle, only display. Video would be perfect. I'm using latest Symfony 2.5. I need simple file upload, without any Sonata Media Bundle, or I must use Sonata for upload?
Only official example I found:
http://symfony.com/doc/current/cmf/bundles/media/introduction.html#uploading-files
and no working code examples.
For uploading, I use the OneupUploaderBundle and use jQuery for my front end. Uploading can be involved because you have to handle different interfaces on users and then also have a method to save files on your server. This bundle allows you to use different front ends for the design and has sever nice events for handling different types of uploads.
I use the included oneup_uploader.pre_upload event to review the file that will be uploaded and use oneup_uploader.post_upload to have the file's name stored in a related entity so I can easily access it from a controller/service. It has some decent examples but post any questions if you are stuck. One of the most useful features for me is the custom logic for uploads.

Amazon S3 folder manipulation with PHP

I have one instance in Amazon EC2. It is a Photobook. User can signup and upload images and they can create a photobook. S for that we want S3 storage. I searched a lot for a good PHP class to manipulate these folders, images and html files.
Now I have no idea how we can create folder, delete folder and search for a folder.
Can anyone help find a solution for these folder/image manipulation requirements like create , search, delete?
The official PHP SDK?
http://aws.amazon.com/sdkforphp/
http://aws.amazon.com/php/
Good question. I was trying to do it now and didn't found the answer in any documentation.
So I discovered that you just need to send the entire path in $keyname parameter:
folder/my_file_name.jpg
The S3 service can recognize and creates automatically the folders.
I think as me, you were looking for a method create_folder-like.
Easy and tricky.

Categories