0

I’m new to the laravel and I’m developing a file uploading system. The files are uploaded and stored to the database just fine, but when I try to call the delete method, it gives this error:

Call to undefined function App\Http\Controllers\riderect()

Here is the FileUpload Controller and its delete method:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Redirect;
use App\UploadedFile;

class FilesController extends Controller
{
public function deleteFile($id)
    {
        $file = UploadedFile::find($id);
        Storage::delete(config('app.fileDestinationPath').'/'.$file->filename);
        return riderect()->to('uploaded');
    }
}

How can this error be avoided?

2 Answers 2

4

It is a spelling error, this:

return riderect()->to('uploaded');

Should be:

return redirect()->to('uploaded');
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much sir.
1

Replace riderect()->to('uploaded'); with redirect()->to('uploaded');

1 Comment

Thank you very much sir.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.