Mattyfog
18-01-2010, 18:54
Sto sviluppando in joomla 1.5 solo che questo componente non carica il file mai.
<?php
/**
* Uploader! Module Entry Point
*
* @package Joomla.Tutorials
* @subpackage Modules
* @link http://www.mattyfog.com
* @license GNU/GPL, see LICENSE.php
* mod_uploader is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
echo '
<div class="componentheading">Uploader</div>'
?>
<?PHP
echo '$_FILES = '.$_FILES['miofile']['tmp_name'];
if(isset($_FILES['attachement']) && !empty($_FILES['attachement']['name']))
{
//RECUPERO IL NOME UTENTE
$user =& JFactory::getUser();
// RECUPERO I PARAMETRI DA PASSARE ALLA FUNZIONE PREDEFINITA PER L'UPLOAD
$cartella = 'upload/';
$percorso = $_FILES['miofile']['tmp_name'];
$nome = $_FILES['miofile']['name'];
//CREO UNA CARTELLA PER L'UTENTE NEL CASO NON ESISTESSE GIA', IN QUESTA CARTELLA VERRANNO CARICATI I FILE DI QUELL'UTENTE
$intDir=$_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/';
if (is_dir($intDir))
{
}
else
{
mkdir($intDir, 0777);
}
// ESEGUO L'UPLOAD CONTROLLANDO L'ESITO
//if (move_uploaded_file($percorso, $_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/'.$nome))
if (move_uploaded_file($percorso, $_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/'.$nome))
{
print "Upload eseguito con successo";
//INVIO DELLA MAIL
$destinatario="mattyfog@tele2.it";
$oggetto="E' stato caricato un file da ".$user->username;
$messaggio="messaggio mail";
mail($destinatario, $oggetto, $messaggio);
}
else
{
print "Si sono verificati dei problemi durante l'Upload";
}
}
else
{
echo "<form action='index.php?option=com_uploader' enctype='multipart/form-data' method='post'>
<input name='miofile' type='file' />
<input type='submit' value='Upload' /> </form>";
}
?>
<?php
/**
* Uploader! Module Entry Point
*
* @package Joomla.Tutorials
* @subpackage Modules
* @link http://www.mattyfog.com
* @license GNU/GPL, see LICENSE.php
* mod_uploader is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
echo '
<div class="componentheading">Uploader</div>'
?>
<?PHP
echo '$_FILES = '.$_FILES['miofile']['tmp_name'];
if(isset($_FILES['attachement']) && !empty($_FILES['attachement']['name']))
{
//RECUPERO IL NOME UTENTE
$user =& JFactory::getUser();
// RECUPERO I PARAMETRI DA PASSARE ALLA FUNZIONE PREDEFINITA PER L'UPLOAD
$cartella = 'upload/';
$percorso = $_FILES['miofile']['tmp_name'];
$nome = $_FILES['miofile']['name'];
//CREO UNA CARTELLA PER L'UTENTE NEL CASO NON ESISTESSE GIA', IN QUESTA CARTELLA VERRANNO CARICATI I FILE DI QUELL'UTENTE
$intDir=$_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/';
if (is_dir($intDir))
{
}
else
{
mkdir($intDir, 0777);
}
// ESEGUO L'UPLOAD CONTROLLANDO L'ESITO
//if (move_uploaded_file($percorso, $_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/'.$nome))
if (move_uploaded_file($percorso, $_SERVER['DOCUMENT_ROOT'].'/upload/'.$user->username.'/'.$nome))
{
print "Upload eseguito con successo";
//INVIO DELLA MAIL
$destinatario="mattyfog@tele2.it";
$oggetto="E' stato caricato un file da ".$user->username;
$messaggio="messaggio mail";
mail($destinatario, $oggetto, $messaggio);
}
else
{
print "Si sono verificati dei problemi durante l'Upload";
}
}
else
{
echo "<form action='index.php?option=com_uploader' enctype='multipart/form-data' method='post'>
<input name='miofile' type='file' />
<input type='submit' value='Upload' /> </form>";
}
?>