A simple PHP class to upload files.
PHP FILE
<?php
$upload = new upload;
$upload->set( 'inputName' , '/var/www/uploads/' , 'images' );
$data = $upload->upload();
print_r( $data );
?>
*HTML FILE*
<form method="post" enctype="multipart/form-data" action="">
<input type="inputName" name="file" />
<input type="submit" value="Upload" />
</form>
*PHP FILE*
<?php
$upload = new upload;
$upload->set( 'file_input' , '/var/www/uploads/' , 'videos' );
$upload->encode_name( true );
$data = $upload->upload();
print_r( $data );
?>
*HTML FILE*
<form method="post" enctype="multipart/form-data" action="">
<input type="file_input" name="file" />
<input type="submit" value="Upload" />
</form>
*PHP FILE*
<?php
$upload = new upload;
$upload->set( 'file_input' , '/var/www/uploads/' , 'images' , 'output_name' );
$data = $upload->upload();
print_r( $data );
?>
*HTML FILE*
<form method="post" enctype="multipart/form-data" action="">
<input type="file_input" name="file" />
<input type="submit" value="Upload" />
</form>
-
set( string $fieldName , string $path [, mixed $allowMimes = null [, string $ouputname = null ] ] )
Set field name
-
encode_name([ bool $bool = true ] )
Encode name
-
upload( )
Upload file(s) and returns data output