kunal
kunal

Reputation: 4248

doc, docx, pdf, csv xls, xlsx extensons not working in livewire laravel - This driver does not support creating temporary URLs

i am facing strange issue. When i upload the image(jpg,jpeg,png) file using livewire its working fine but when i try to upload any other file type its giving me error this error This driver does not support creating temporary URLs. Not sure is livewire doesnot support to upload doc, docx, pdf, csv xls, xlsx if yes its very strange?. Or i am doing something wrong in code. here is my below code:-

<form wire:submit.prevent="save">
    
    <input type="file" wire:model="documnet">
    @error('documnet') <span class="error">{{ $message }}</span> @enderror
         <!-- Progress Bar -->
    <div x-show="isUploading">
        <progress max="100" x-bind:value="progress"></progress>
    </div>
    <div wire:loading wire:target="save">Uploading...</div>
    <button type="submit">Save documnet</button>
</form>

In this user input any type of document (jpg, jpeg, png , doc, docx, pdf, csv xls, xlsx ). Here is my below component code

public function save(){
    $extension = $this->document->getClientOriginalExtension();
    // Filename to store
    $fileNameToStore = uniqid().'_'.time().'.'.$extension;
    // Upload Image
    $path = $this->document->storeAs('public',$fileNameToStore);
}

enter image description here

Can anyone help me what i am doing wrong or livewire not supports to upload these extensions?

Upvotes: 1

Views: 2424

Answers (2)

Mehmet MERCAN
Mehmet MERCAN

Reputation: 106

publish the config file with,

php artisan livewire:publish --config

Then add mime type of file you want to upload to preview_mimes under the temporary_upload_file in config file.

Upvotes: 5

peyman.sia
peyman.sia

Reputation: 11

Supported file types for temporary file urls are set in: config/livewire.php temporary_file_upload->preview_mimes array for support

Upvotes: 1

Related Questions