Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

theUnforgiven's avatar

File not found, Vapor, Vue

HI all,

I am getting the following error and unable to set the file visibility to public.

I also want it moving from the tmp directory too, which I though this code did:

$replace = str_replace('tmp/', '', $request->input('key'));
$stored = '/uploads/' . user()->id . '/legal/' . $request->input('key');
$moved = Storage::move($replace, $stored);
Storage::setVisibility(str_replace('tmp/', '', $stored, 'public'); //This doesn;'t set to public either

Vue

<form method="post" enctype="multipart/form-data" @submit.prevent="uploadFile">
            <input type="file" name="file" id="file" ref="file">
            <button type="submit" class="btn btn-sm btn-outline-success">Upload</button>
            <div class="mt-3 mb-3" v-if="uploadProgress">
                <span class="alert alert-success">Upload Complete</span>
            </div>
        </form>

Then the method within Vue:

uploadFile() {
            Vapor.store(this.$refs.file.files[0], {
                progress: progress => {
                    setTimeout(() => {
                        this.uploadProgress = Math.round(progress * 100);
                    }, 1000);
                }
            }).then(response => {
                axios.post('/api/file/upload', {
                    uuid: response.uuid,
                    key: response.key,
                    bucket: response.bucket,
                    name: this.$refs.file.files[0].name,
                    content_type: this.$refs.file.files[0].type,
                    url: response.url,
                    optional: this.optional,
                    property_id: this.property_id,
                });
                setTimeout(() => {
                    swal({
                        title: 'Success!',
                        text: 'File successfully uploaded and saved.',
                        icon: 'success',
                        button: 'Continue',
                    });
                }, 1300); 
                this.uploadProgress = false;   
            });
        }
0 likes
2 replies
theUnforgiven's avatar

The file is getting uploaded to S3 it seems, so not sure why the error is showing and also why it's not setting the files visibility to public.

Any advice/help greatly appreciated.

tinfoilman's avatar

Did you ever figure this out? I remember having a similar error when I was trying to get S3 to work. I can't quite remember, but I think I had to install another package with composer. Check your composer.json file and make sure you have this in your "require"

    "league/flysystem-aws-s3-v3": "~1.0",

Please or to participate in this conversation.