Bossino's avatar

cannot upload a zip file

Hello, I'm testing to upload a zip file with this code and I believe is applicable with any file types.

public function store(Request $request)
{
        $file = $request->file('filename');
        $filename = $file->getClientOriginalName();  
        $file->move(public_path(), $filename);  

        return redirect()->back();
}

It would just keep loading and no errors are showing in my network tab.

0 likes
8 replies
Sinnbeck's avatar

And maybe try restating the php service on your computer if it hangs :)

Bossino's avatar

@Sinnbeck

<form autocomplete="off" method="POST" action="{{ route("data.store") }}" enctype="multipart/form-data">
        @csrf
        <div class="form-group">
            <input type="file" name="filename">
        </div>
        <div class="form-group">
            <button class="btn btn-success" type="submit">
                Save
            </button>
        </div>
   </form>
Sinnbeck's avatar

@Bossino does it ever stop loading so you can use the rest of the app and try again?

Do you perhaps have xdebug running?

Bossino's avatar

@Sinnbeck I don't have xdebug running. It doesn't stop loading. I just checked in my network tab but no errors showing.

Sinnbeck's avatar

Be aware that your code let's anyone "hack" your website in minutes

Bossino's avatar

@Sinnbeck just my practice code before applying it in my final project and is only running in my local

Please or to participate in this conversation.