How to upload file and store to database ? Hi I am New to laravel 5 . I am trying to figure out how to upload file to a database .
I am attaching the screen shots please guide me how to do it .
First I made a view and used form builder .
">
This is my upload button.
I made the migrations but not sure its correct for file upload .
Controller :
Model :
Route file :
please tell me how to upload the file and store it in the database and how to add validation also on it .
Thank you in advance .
All the files are not accessible... You can put your code between backticks
` $hello = 'Hello World';`
This will display like this:
$hello = 'Hello World';
If you use 3 backticks you get a code block
Here is a good guide on uploading images: http://tutsnare.com/upload-files-in-laravel/
Thank You for your reply . Please tell me how will I proceed .
Thank you for your reply . What would be the migration table for file upload ?
Here you have an example for a tasks_files table, I recommend you associate your file with your main entity
Schema::create('tasks_files', function(Blueprint $table)
{
$table->increments('id');
$table->integer('task_id')->unsigned();
$table->string('name', 10);
$table->integer('size')->unsigned();
$table->string('real_name', 255);
$table->string('extension', 10);
$table->string('mime', 15);
$table->timestamps();
$table->softDeletes();
});
Why don't you first try something before asking! You are not learning from just copying here... Just give it a try and if you are stuck you come back to the forum ;)
Please sign in or create an account to participate in this conversation.