I am new and i don't know where is the mistake, I think I have taken care the routes and all but still i am not sure. Please help me out. so when I do 'localhost:8000/uploadfile/' it gives me this error This site can’t be reached localhost refused to connect. Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED and when i go through the detail url it gives me: the view[uploadfile] not found this is my form:
<!DOCTYPE HTML>
<html>
<body>
<?php
echo Form::open(array('url'=>'/uploadfile','files'->'true'));
echo 'Select the file to upload';
echo Form::file('image');
echo Form::submit('upload file');
echo Form::close();
?>
</body>
</html>
my controller is:
<?php
namespace App\Http\Controllers;
use App\files;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\Http\Controllers\Controller;
class UploadFileController extends Controller {
public function index() {
return view('uploadfile');
}
public function showUploadFile(Request $request) {
$file = $request->file('image');
//Display File Name
echo 'File Name: '.$file->getClientOriginalName();
echo '<br>';
//Display File Extension
echo 'File Extension: '.$file->getClientOriginalExtension();
echo '<br>';
//Display File Real Path
echo 'File Real Path: '.$file->getRealPath();
echo '<br>';
//Display File Size
echo 'File Size: '.$file->getSize();
echo '<br>';
//Display File Mime Type
echo 'File Mime Type: '.$file->getMimeType();
//Move Uploaded File
$destinationPath = 'uploads';
$file->move($destinationPath,$file-
>getClientOriginalName());
}
}
finally my route Route::get('/uploadfile','UploadFileController@index'); Route::post('/uploadfile','UploadFileController@showUploadFile');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire