2017 © Pedro Peláez
 

library file-management

this class can import files from a url or move, copy and rename an existing file on the server

image

jamieynonan/file-management

this class can import files from a url or move, copy and rename an existing file on the server

  • Thursday, June 23, 2016
  • by JamieYnonan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

file-management

This library can import files from a url or move, copy and rename an existing file on the server.\ Esta libreria puede importar archivos desde una url o mover, copiar y renombrar un archivo existente en el servidor.\ Questa libreria può imporatare file da una url oppure spostare, copiare e rinominare un file esistente nel server., (*1)

example

use FileManagement\File;


$imgLocal = new File(__DIR__ .'/file.jpg'); //file
$imgUrl = new File('http://site.com/files/image.png'); //link

validate mime (optional - recommend), (*2)

//return bool
$imgLocal->validateMime('image/jpeg');
$imgUrl->validateMime('image/png');

save file, (*3)

first set the path to save the file
$imgLocal->setPath(__DIR__ . '/files');
$imgUrl->setPath('/path/local/where/save/file');

$imgLocal->save();
$imgUrl->save('new-name'); //save and change name

copy, move, rename (Only allowed for internal files -on the server-), (*4)

//return new instance of File
$newImage = $imgLocal->copy('/same/path', 'new-name'); //copy with another name
$newImage2 = $newImage->copy('/new/path2'); //copy in another folder with the same name

$newImage2->move('/other/path'); //return bool

$newImage2->rename('new-name-file'); //return bool

The Versions

23/06 2016

dev-master

9999999-dev

this class can import files from a url or move, copy and rename an existing file on the server

  Sources   Download

GLP-2.0

The Requires

  • php >=5.4

 

23/06 2016

1.0.1

1.0.1.0

this class can import files from a url or move, copy and rename an existing file on the server

  Sources   Download

GLP-2.0

The Requires

  • php >=5.4

 

13/06 2016

1.0.0

1.0.0.0

this class can import files from a url or move, copy and rename an existing file on the server

  Sources   Download

GLP-2.0

The Requires

  • php >=5.4