blumxi's avatar

is_file() / is_readable() always returns false on uploaded file

Hello everyone.

On my website the user can upload an xls or xlsx file in order to import data into a database.

This is a portion of my upload function:

 $request->validate([
        'xlsFileUploadForm' => 'required|file|max:1024|mimes:xls,xlsx',
    ]);                             
    $extension = $request->xlsFileUploadForm->extension();
    $path = $request->xlsFileUploadForm->storeAs('xlsFiles', 'xlsFile'.'.'.$extension);

To read the xls file, I use the library "spreadsheet-reader". I call it like this:

$Reader = new SpreadsheetReader($path);

However, this doesn't seem to work. In the constructor the library uses the is_readable() method to check ... well.. if the file is readable. This always returns false for me. To get more information I used the is_file() method before calling the library, but that also returns false. I also tried other links, like Storage::url($filename); but that doesn't work neither.

What am I doing wrong?

0 likes
2 replies
Sinnbeck's avatar

Try Storage::path($filename) instead. Does it say the same?

Also try dd($path); to see where it points

Please or to participate in this conversation.