Skip to content

Instantly share code, notes, and snippets.

@ElyDotDev
Last active February 13, 2016 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElyDotDev/402e289d69d98d25ac78 to your computer and use it in GitHub Desktop.
Save ElyDotDev/402e289d69d98d25ac78 to your computer and use it in GitHub Desktop.
SecureUPload – PHP secure file upload package Home: http://projects.allii.ir/project/srcureupload/
<?php
use Alirdn\SecureUPload\Config\SecureUPloadConfig;
use Alirdn\SecureUPload\SecureUPload;
// Create SecureUPloadConfig and set Uploaded files folder
$SecureUPloadConfig = new SecureUPloadConfig;
$SecureUPloadConfig->set( 'upload_folder', 'uploads' . DIRECTORY_SEPARATOR );
// Create SecureUPload and give previously created config to it
$SecureUPload = new SecureUPload( $SecureUPloadConfig );
// Upload a file
$Upload = $SecureUPload->uploadFile( 'file' );
// Check uploaded file
if ( $Upload->status ) {
// File has been set in <input type="file" name="file"/>
if ( $Upload->status == 1 ) {
echo 'File uploaded successfully. Id: ' . $Upload->id;
} else {
echo 'File didn\'t uploaded. Error code: ' . $Upload->error;
}
} else {
// No file is selected in input field
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment