Renaming file while uploading Laravel

Today, We want to share with you Renaming file while uploading Laravel.In this post we will show you php Laravel 6 rename uploaded file keep extension, hear for laravel download file from url to storage we will give you demo and example for implement.In this post, we will learn about php Laravel 6 rename uploaded file keep extension with an example.

Renaming file while uploading Laravel

There are the Following The simple About Laravel 6 Change filename when uploading using store Full Information With Example and source code.

Also Read This πŸ‘‰   Laravel Check Value Existence in Array

As I will cover this Post with live Working example to develop Rename a file before moving it to Directory, so the File uploads in Laravel 6 Single and multiple is used for this example is following below.

Step 1: Create a controller page


namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;

class MobileController extends Controller 
	public function mobileDisplay()
		return view('Mobile_list');
	public function processFile(Request $request)
	if (Input::hasFile('file'))
		$file = Input::file('file');
		$destinationPath = '../files';
		$mobile_img_name = rand().time();
		$file ->move($destinationPath, $mobile_img_name);
		echo "Good Luck Your File is Uploaded Successfully!</br>";

step 2: create a Laravel Blade view page


<!DOCTYPE html>
    <title>Laravel 6 Rename file - Free Download Source code</title>
    <link rel="stylesheet" href="">
	<h1>Laravel 6 Change filename when uploading using store</h1>
	<form action="mobile_uploded" method="post" enctype="multipart/form-data">
		<table align="center">
			<tr><td><b>Your File Rename</b></td>
			<td><input type="file" name="file"></td></tr>
			<input type = "hidden" name = "_token" value = "<?php echo csrf_token() ?>"></td></tr>
			<input type="submit" name="upload" value="mobile_uploded"></td>

Step 3: Define a Laravel Route


Route::get('/RenameDisplay','[email protected]');
Route::post('/mobile_uploded','[email protected]');

Web Programming Tutorials Example with Demo

Read :

Also Read This πŸ‘‰   File Upload in Laravel 7 Example Tutorial


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel get uploaded file path.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.