Код: Выделить всё
public function dataPost(Request $request) {
$fileInForm = 'doc';
if ($request->hasFile($fileInForm)) {
$file = $request->file($fileInForm);
if ($file->isValid()) {
// Filename is hashed filename + part of timestamp
$hashedName = hash_file('md5', $file->path());
$timestamp = microtime() * 1000000;
$newFilename = $hashedName . $timestamp . '.' . $file->getClientOriginalExtension();
Storage::disk('local')->put($newFilename, $file);
}
}
}
Код: Выделить всё
storage/app/952d6c009.jpg/952d6c009.jpgКод: Выделить всё
storage/app/234234234.jpg/234234234.jpgСпасибо!
Подробнее здесь: https://stackoverflow.com/questions/400 ... -file-name
Мобильная версия