davy_yg's avatar
Level 27

Upload Attachment

Hello,

I would like to upload file attachment to the correct location.

form.blade.php

<div class="custom-file">
                <!-- <button><input type="file" class="custom-file-input" id="file_attachment" name="file_attachment">Choose File</button> -->
                <input type="file" class="custom-file-input" id="file_attachment" name="file_attachment" required>Choose File2
                <label class="custom-file-label" for="validatedCustomFile">Choose file...</label>
            <div class="invalid-feedback">Example invalid custom file feedback</div>
            </div>

PageController.blade.php

$m = new ApplicationModel;

$m->attachment    = $request->file_attachment;

$m->save();

When I check the upload address : C:\xampp\tmp\php28E7.tmp

This is strange the file is CV.doc - it should be word document.

0 likes
3 replies
davy_yg's avatar
Level 27

Yes, after the upload the link turns into:

C:\xampp\tmp\php28E7.tmp

I should be able to upload a word or a pdf doc

Snapey's avatar

study ANY of the file upload tutorials on the net, or Laravel docs. This is just lazy.

3 likes

Please or to participate in this conversation.