HTha's avatar
Level 1

When I upload test.apk file it save it as test.zip in laravel 9

I have 2 issue: 1 - it save the file with different name like: jdskfjsljfks 2 - it save the file as .zip, and it is .apk

0 likes
3 replies
HTha's avatar
Level 1

@Sinnbeck

upload.blade.php:

<html>
<body>
    <?php
        echo Form::open(array('url' => '/upload','files'=>'true'));
        echo 'Select the file to upload.';
        echo Form::file('apk');
        echo Form::submit('Upload File');
        echo Form::close();
    ?>
</body>
</html>

UploadController:

class UploadController extends Controller
{
    public function indexx()
    {
        return view('upload');
    }

    public function upload(Request $request)
    {
        $path = request()->file('apk')->store('apk', 'public');
        return redirect()->back();
    }
}

web.php:

Route::get('upload','App\Http\Controllers\UploadController@indexx');
Route::post('/upload', 'App\Http\Controllers\UploadController@upload');

Please or to participate in this conversation.