+ Reply to Thread
Results 1 to 5 of 5
Like Tree3Likes
  • 2 Post By nyanko
  • 1 Post By Deviante

Thread: Problema subiendo archivos con php =/

  1. #1
    nyanko's Avatar
    nyanko is offline x10Hosting Member nyanko is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    In front of my pc
    Posts
    57

    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 12:49 AM. Reason: Automerged Doublepost
    dinomirt96 and karimirt47 like this.

  2. #2
    nyanko's Avatar
    nyanko is offline x10Hosting Member nyanko is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    In front of my pc
    Posts
    57

    Re: Problema subiendo archivos con php =/

    De Alguna Forma inexplicable, ahora funciona o.o

  3. #3
    evigra is offline x10 Sophmore evigra is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Colima, Mexico
    Posts
    242

    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...

  4. #4
    Deviante is offline x10Hosting Member Deviante is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    9

    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
    verlmirt17 likes this.

  5. #5
    gruponov's Avatar
    gruponov is offline x10 Sophmore gruponov is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Medellin
    Posts
    231

    Re: Problema subiendo archivos con php =/

    chicos hay problema con el host esta caido stoli

+ Reply to Thread

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. Problema para cambiar la version Php
    By SoulEaterARG in forum Soporte
    Replies: 2
    Last Post: 07-30-2008, 05:36 PM
  3. php problem
    By himgar in forum Free Hosting
    Replies: 1
    Last Post: 02-22-2008, 02:41 AM
  4. Cambios IMPORTANTES en PHP.
    By Fedlerner in forum Noticias y Anuncios
    Replies: 1
    Last Post: 11-06-2007, 11:13 AM
  5. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers