Onga inc

subtitle

Laravelファイルのアップロードサンプル

Laravelで画像ファイルのアップロードのサンプルです。
メソッドも用意されておりシンプルな操作でアップロードが可能です。

`
if($input['file']){
    $extension= $input['file']->guessExtension();
    $input['file']->move(STATIC_IMAGE_PATH,$user->id.'.'.$extension);
    $user->img=$user->id.'.'.$extension;
}
`

API
http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/File/UploadedFile.html#method_guessExtension

参考サイト
http://dim5.net/laravel/file-upload-form.html

Onga

A designer, developer and entrepreneur. Spends his time travelling the world with a bag of kites. Likes journalism and publishing platforms.

Comments