[李景山php]每天laravel-20161017|UploadedFile.php
2016-08-19 09:13
417 查看
<?php namespace Illuminate\Http; use Illuminate\Support\Traits\Macroable; use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile; // more name space and trait class UploadedFile extends SymfonyUploadedFile { use Macroable;// use trait /** * Get the fully qualified path to the file. * * @return string */ public function path() { return $this->getRealPath(); }// get path ,then use the real path /** * Get the file's extension. * * @return string */ public function extension() { return $this->guessClientExtension(); }// get extension /** * Get a filename for the file that is the MD5 hash of the contents. * * @return string */ public function hashName() { return md5_file($this->path()).'.'.$this->extension();// md5_file }//Get a filename for the file that is the MD5 hash of the contents. // get a type of the md5 about file /** * Create a new file instance from a base instance. * * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file * @return static */ public static function createFromBase(SymfonyUploadedFile $file) { return $file instanceof static ? $file : new static( $file->getPathname(), $file->getClientOriginalName(), $file->getClientMimeType(), $file->getClientSize(), $file->getError() );// return $file // to long }// Create a new file instance from a base instance. }
相关文章推荐
- [李景山php]每天laravel-20161017|UploadedFile.php
- [李景山php]每天laravel-20160916|FileSystemServiceProvider
- [李景山php]每天laravel-20161027|FileLoader.php
- [李景山php]每天laravel-20160913|FileSystemAdapter
- [李景山php]每天laravel-20161017|ResponseTrait.php
- [李景山php]每天laravel-20160914|FileSystemManager-1
- [李景山php]每天laravel-20160913|FileSystemAdapter
- [李景山php]每天laravel-20160915|FileSystemManager-2
- [李景山php]每天laravel-20161027|FileLoader.php
- [李景山php]每天laravel-20161017|ResponseTrait.php
- [李景山php]每天laravel-20160916|FileSystemServiceProvider
- [李景山php]每天laravel-20160914|FileSystemManager-1
- [李景山php]每天laravel-20160915|FileSystemManager-2
- [李景山php]每天laravel-20160901|Dispatcher-1
- [李景山php]每天laravel-20160905|Dispatcher-5
- [李景山php]每天laravel-20160902|Dispatcher-2
- [李景山php]每天laravel-20160903|Dispatcher-3
- [李景山php]每天laravel-20160906|Dispatcher-6
- [李景山php]每天laravel-20160830|CallQueuedHandler
- [李景山php]每天laravel-20160902|Dispatcher-2