管理作为base64字符串上载的文件

I am currently developing a website with AngularJS for the frontend, and a restful web service using Laravel framework (PHP5) as backend ; I am currently face to one problem, file uploading. I would like to have a very simple file uploaded, with a file input and just some copy into one of the server folder.

For now, I am using a directive in AngularJS that work great, and send my file using base64 url ; I am able to get this string inside my PHP backend, but unable to transform it to a file. For example, I would like to be able to get the filename, ext, ... and copy it to the server..

Any idea how to convert a base64 to a "file object" ? (Whether the solution is designed for Laravel et simple PHP doesn't bother me).

It's pretty easy just decode the base 64 String on your server and write into a file.

Example if the image is located in forms image data and data were send as POST:

file_put_contents('path/to/images/image.jpg', base_64_decode($_POST['image']));

I'm not firm with laravel but I think there are better ways inside the Framework than accessing form data PHP's $_POST Array directly.

To find of the filetype of the image have a look at finfo_buffer and see how to use for your case here