Skip to content

Instantly share code, notes, and snippets.

@alirdn alirdn/basic-usage.php Secret
Last active Feb 13, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.