Skip to content

Commit

Permalink
joomla 4
Browse files Browse the repository at this point in the history
  • Loading branch information
diddipoeler committed Mar 19, 2023
1 parent c82d82d commit 21c33a3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
35 changes: 35 additions & 0 deletions admin/models/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,41 @@ public function __construct($config = array())
}


/**
* sportsmanagementModelplayers::importupload()
* https://www.w3schools.com/php/php_file_upload.asp
* @param mixed $post
* @return void
*/
function importupload($post = array())
{
Factory::getApplication()->enqueueMessage(Text::_(__METHOD__.' '.__LINE__.' task <pre>'.print_r(Factory::getApplication()->input->post->getArray(),true).'</pre>' ), '');
$target_dir = "tmp/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
Factory::getApplication()->enqueueMessage(Text::_(__METHOD__.' '.__LINE__.' task <pre>'.print_r($target_file,true).'</pre>' ), '');


// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}




}



/**
* sportsmanagementModelplayer::getAgeGroupID()
*
Expand Down
37 changes: 0 additions & 37 deletions admin/models/players.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,6 @@ public function __construct($config = array())
parent::setDbo($this->jsmdb);
}



/**
* sportsmanagementModelplayers::importupload()
* https://www.w3schools.com/php/php_file_upload.asp
* @param mixed $post
* @return void
*/
function importupload($post = array())
{
Factory::getApplication()->enqueueMessage(Text::_(__METHOD__.' '.__LINE__.' task <pre>'.print_r(Factory::getApplication()->input->post->getArray(),true).'</pre>' ), '');
$target_dir = "tmp/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
Factory::getApplication()->enqueueMessage(Text::_(__METHOD__.' '.__LINE__.' task <pre>'.print_r($target_file,true).'</pre>' ), '');


// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}




}




/**
* sportsmanagementModelplayers::getListQuery()
Expand Down

0 comments on commit 21c33a3

Please sign in to comment.