本文整理汇总了PHP中file::guessExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP file::guessExtension方法的具体用法?PHP file::guessExtension怎么用?PHP file::guessExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::guessExtension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preUpload
/**
* @ORM\PrePersist
*/
public function preUpload()
{
if (null !== $this->file) {
// do whatever you want to generate a unique name
$this->photo = uniqid() . '.' . $this->file->guessExtension();
}
}
示例2: preUpload
/**
* @ORM\PrePersist
*/
public function preUpload()
{
if (null !== $this->file) {
// do whatever you want to generate a unique name
$this->picture_name = $this->file->getClientOriginalName();
$this->picture = $this->username . '.' . $this->file->guessExtension();
}
}
示例3: preUploadFile2
/**
* @ORM\PrePersist
*/
public function preUploadFile2()
{
if (null !== $this->file2) {
// do whatever you want to generate a unique name
$this->second_fichier_nom = $this->file2->getClientOriginalName();
$this->second_fichier = uniqid() . '.' . $this->file2->guessExtension();
}
}
示例4: upload
public function upload()
{
// var_dump(pathinfo($this->file, PATHINFO_EXTENSION));die();
if (null === $this->file) {
return false;
} else {
$this->path = sha1(uniqid(mt_rand(), true)) . '.' . $this->file->guessExtension();
}
$this->file->move($this->getUploadRootDir(), $this->path);
unset($this->file);
return true;
}
示例5: preUpload
/**
* @ORM\PrePersist()
* @ORM\PreUpdate()
*/
public function preUpload()
{
if (null !== $this->file) {
// faites ce que vous voulez pour générer un nom unique
$this->photo = sha1(uniqid(mt_rand(), true)) . '.' . $this->file->guessExtension();
}
}