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 21c33a3 commit 0413403
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions admin/models/player.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Filesystem\File;


/**
* sportsmanagementModelplayer
Expand Down Expand Up @@ -48,6 +50,9 @@ public function __construct($config = array())
*/
function importupload($post = array())
{
jimport('joomla.filesystem.file');

/**
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"]);
Expand All @@ -67,8 +72,22 @@ function importupload($post = array())
echo "Sorry, there was an error uploading your file.";
}
}
*/

// Cleans the name of teh file by removing weird characters
$filename = File::makeSafe($_FILES["fileToUpload"]['name']);

$src = $_FILES["fileToUpload"]['tmp_name'];
$dest = JPATH_BASE . '/tmp/' . $filename;

if (File::upload($src, $dest))
{
// The file has successfully been uploaded :)
}
else
{
// Oh crap, something happened. Run!
}


}
Expand Down

0 comments on commit 0413403

Please sign in to comment.