Aun no se porque mi script se niega a subir avatars a mi web D:
Siempre me regresa un error del tipo Archivo incorrecto, y funcionaba bien en mi servidor local (apache2.2 php5 mysql5.45) pero aparentemente aqui no, No logra pasar del segundo IF, aun con imagenes jpg o gif.
Posteo Codigo D:
PD: no se si esto ayude pero estuve probando e imprimi la variable $_FILES en pantalla y me dio esto:PHP Code://------------------------------------------------------------------------------
// Create contentObj for this content object
//------------------------------------------------------------------------------
$thisContentObj = &New contentObj;
$thisContentObj->contentType = "generic";
$thisContentObj->primaryContent = $menuStr;
if (array_key_exists('imagefile', $_FILES)) // Check to see if a file is being uploaded...
{
// Check if uploaded file is correct file type
if (($_FILES['imagefile']['type'] == "image/jpeg" || $_FILES['imagefile']['type'] == "image/pjpeg" || $_FILES['imagefile']['type'] == "image/png" || $_FILES['imagefile']['type'] == "image/gif") && in_array(strtolower(substr(strrchr($_FILES['imagefile']['name'], '.'),1)), array('gif', 'jpg', 'jpeg', 'png')))
{
if (filesize($_FILES['imagefile']['tmp_name']) > 25000)
{
// File is too big. Tell them to resize it and try again
$thisContentObj->primaryContent .="<h2>$LANG[FILE_TOO_LARGE] (" . filesize($_FILES['imagefile']['tmp_name']) . " bytes)</h2><br/><br/>";
}
else
{
// File is correct type and size. Copy it to server and update user's profile accordingly.
$file_ext_array = explode("." , $_FILES['imagefile']['name']);
$file_ext = $file_ext_array[ sizeof($file_ext_array) - 1 ];
if (!move_uploaded_file( $_FILES['imagefile']['tmp_name'] , "images/$CURRENTUSER.$file_ext" ))
$thisContentObj->primaryContent .= "<b>$LANG[AV_UP_FAILED]</b><br/><br/>";
else
{
mf_query("update users set avatar='images/$CURRENTUSER.$file_ext' where username='$CURRENTUSER'") or die(mysql_error());
$thisContentObj->primaryContent .= "<h2>$LANG[NEW_AV]:</h2><img src='images/$CURRENTUSER.$file_ext' width=100 height=100><br/><br/>";
}
}
}
else
{
print_r($_FILES);
$thisContentObj->primaryContent .= "<h2>$LANG[INCORRECT_FILE_TYPE]: " . $_FILES['imagefile']['type'] . "</h2><br/><br/>";
}
}
else // no file was being uploaded, display current avatar
{
$thisContentObj->primaryContent .= "<h2>$LANG[CURRENT_AVATAR]:</h2>";
$av = mf_query("select avatar from users where username='$CURRENTUSER' limit 1") or die(mysql_error());
$av = mysql_fetch_array($av);
if ($av['avatar'] != "")
$thisContentObj->primaryContent .= "<img src='$av[avatar]' width=100 height=100><br/><br/>";
else
$thisContentObj->primaryContent .= "(none)<br/><br/>";
}
$thisContentObj->primaryContent .= "$LANG[UPLOAD_AVATAR]:
<form name='upload' method='post' action='index.php?shard=usercp&action=g_avatar' enctype='multipart/form-data'>
<input type=hidden name='upload_flag' value='true' />
<input type='file' name='imagefile'>
<input type='submit' name='Submit' value='Submit' /><br/><br/>
$LANG[AVATAR_RULES].";
//------------------------------------------------------------------------------
// Add this contentObject to the shardContentArray
//------------------------------------------------------------------------------
$shardContentArray[] = $thisContentObj;
break;
Mi cuenta tiene el php intermedio, Sospecho que es una limitacion impuesta por el servidor, pues como dije funcionaba en mi servidor local.Code:Array ( [imagefile] => Array ( [name] => ok.gif [type] => [tmp_name] => [error] => 8 [size] => 0 ) )
Al parecer no logra subir el archivo al servidor para revisar si es del tipo correcto >_<.
Gracias por la ayuda de antemano D:
Edit:
bump T_T
Edit:
si algun mod ve esto mover a soporte >_> no creo k nadie me ayude aki T_T


3Likes
LinkBack URL
About LinkBacks
Reply With Quote


