S
S
Sergey Khlopov2019-09-06 10:15:35
Laravel
Sergey Khlopov, 2019-09-06 10:15:35

Is it possible to find out the upload time of a file to the server?

Hello, can you please tell me how to find out the time of uploading a file to the server? from the method file. Thank you in advance for your response

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Khlopov, 2019-09-06
@Shlop

Found this solution:

$mod = Storage::disk('uploads')->lastModified('/categories/content/5d72130279af09.62535395/aCyOU8V72n8y2GcX2CS1avvV2xAdexfTNs97I3lc.jpeg');
        echo date("Y-m-d\TH:i\Z", $mod);

It seems to work as it should, documentation on the method lastModified: https://laravel.com/docs/5.8/filesystem#file-metadata
my picture is compressed when loading, and this is probably considered a modification, so when I get the last modification of the file, I get the time when it was loaded

D
Dmitry, 2019-09-06
@Compolomus

There are three functions for file time, choose the one you need
https://www.php.net/manual/ru/function.filemtime.php
https://www.php.net/manual/ru/function.filectime.php
https:/ /www.php.net/manual/en/function.fileatime.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question