x10Hosting Forums

Corporate Free Hosting for the Masses.


x10Hosting wishes you a great Year!

Register

Reply
 
LinkBack Thread Tools Display Modes
x10Hosting Member

nyanko's Avatar

Join Date: Jul 2008
Posts: 57
Credits: 616
nyanko is on a distinguished road
Location: In front of my pc

Quote  
08-31-2008, 01:49 AM
Problema subiendo archivos con php =/

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:
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_arraysizeof($file_ext_array) - ];                    
                    
                    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&amp;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; 
PD: no se si esto ayude pero estuve probando e imprimi la variable $_FILES en pantalla y me dio esto:

Code:
Array 
( 
  [imagefile] => Array         
  ( 
    [name] => ok.gif 
    [type] =>              
    [tmp_name] =>
    [error] => 8             
    [size] => 0 
  )  
)
Mi cuenta tiene el php intermedio, Sospecho que es una limitacion impuesta por el servidor, pues como dije funcionaba en mi servidor local.
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

Last edited by nyanko; 08-31-2008 at 01:49 AM. Reason: Automerged Doublepost
Reply With Quote
nyanko is offlineReport Post
x10Hosting Member

nyanko's Avatar

Join Date: Jul 2008
Posts: 57
Credits: 616
nyanko is on a distinguished road
Location: In front of my pc

Quote  
09-02-2008, 05:31 AM
Re: Problema subiendo archivos con php =/

De Alguna Forma inexplicable, ahora funciona o.o
Reply With Quote
nyanko is offlineReport Post
x10Hosting Member

Join Date: Jan 2008
Posts: 68
Credits: 705
evigra is on a distinguished road
Location: Colima, Mexico

Send a message via MSN to evigra
Quote  
11-15-2008, 09:42 AM
Re: Problema subiendo archivos con php =/

Quote:
Originally Posted by nyanko View Post
De Alguna Forma inexplicable, ahora funciona o.o
Oye... yo tengo ese problema tambien, y a mi me marcaba error con el $_files...

me marcaba error 8 me puse a buscar y encontre que se refiere a las extenciones pero por mas que intento no puedo hacer que funcione!!!!!!!!.. ese es todo tu codigo??? para ver si a mi me funciona tambien despues de manera inexplicable...
Reply With Quote
evigra is offlineReport Post
x10Hosting Member

Join Date: Sep 2008
Posts: 5
Credits: 244
Deviante is on a distinguished road
Quote  
11-17-2008, 09:26 AM
Re: Problema subiendo archivos con php =/

a las malas kitadle la identificacion del tipo d imagen y acerle uno casero k lea los 3 ultims caracteres del nombre y os dvolvera la extension y arreando
Reply With Quote
Deviante is offlineReport Post
x10 Sophmore

gruponov's Avatar

Join Date: Jul 2008
Posts: 131
Credits: 1,207
gruponov is on a distinguished road
Location: Medellin

Quote  
12-15-2008, 08:02 PM
Re: Problema subiendo archivos con php =/

chicos hay problema con el host esta caido stoli
__________________
Reply With Quote
gruponov is offlineReport Post
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problema para cambiar la version Php SoulEaterARG Soporte 2 07-30-2008 06:36 PM
php problem himgar Free Hosting 1 02-22-2008 03:41 AM
Cambios IMPORTANTES en PHP. Fedlerner Noticias y Anuncios 1 11-06-2007 12:13 PM
Sigo con problemas con phpbb2 reciecho Soporte 7 10-20-2007 07:28 PM
Ever Been Suspended For Using PHP? dragoneye_xp Off Topic 24 07-11-2006 02:05 PM


All times are GMT -5. The time now is 04:32 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios