-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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