Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Landerson Almeida

Erro no Sistema de Upload

Recommended Posts

Olá Tenho um Sistema de Upload Neste Site : http://50.97.101.2/~serve957/admin/

E Quando Tento Enviar um Arquivo (Foto) Diz Isso : File could not be saved (check folder permissions)

Pelo Que eu vi pediu pra Checar as Permissoes das Pastas Eu ja fiz isso os Arquivs eu Coloquei 644 e Pasta 755 de permissao e Nada Ja nao sei oque fazer Mais! :( Detalhes: Tenho Hospedagem Na Hostgator Plano M , Um Desenvolvedor Ou Algue Que saiba oque Causa este Erro Me Ajudeem , Estou Aguardando resposta Anteciosamente...

Compartilhar este post


Link para o post
Compartilhar em outros sites

bom, então não adianta ficar especulando possiveis soluções

tenta 0777

como WDuarte falou, coloque 0777, caso não resolva, o problema estar no upload.

 

agora, tome cuidado com sql injection, pois no seu site tem um sistema de login, que não está protegido

Compartilhar este post


Link para o post
Compartilhar em outros sites

Index.php

<?php

/**
 * Bootstrap loader
 *
 * @author		UploadScript
 * @since		16 July 2009
 * @version		1
 * @package		core
 * @copyright	UploadScript
 */

/**
 * Define the base path
 */
define( 'BASE_PATH', str_replace( '\\', '/', realpath( dirname( __FILE__ ) ) ) . '/' );

/**
 * Grab our registry and controller files
 */
require_once( BASE_PATH . 'library/registry.php' );
require_once( BASE_PATH . 'library/controller.php' );

/**
 * And then initialize the controller gateway
 */
Controller::initialize();
exit();

registy.php

<?php

class Registry
{
    private static $instance = NULL;
    private static $classes = NULL;
    public static $settings = array( );
    public static $input = array( );
    public static $member = array( );
    protected static $secureKey = "";

    private function __construct( )
    {
        if ( !file_exists( BASE_PATH."config.php" ) )
        {
            exit( "Your configuration file is missing." );
        }
        require_once( BASE_PATH."config.php" );
        foreach ( $CONFIG as $k => $v )
        {
            self::$settings[$k] = $v;
        }
        unset( $CONFIG );
        self::$settings['base_url'] = substr( self::$settings['base_url'], 0 - 1 ) == "/" ? self::$settings['base_url'] : self::$settings['base_url']."/";
        self::$settings['files_path'] = str_replace( "\\", "/", self::$settings['files_path'] );
        self::$settings['files_path'] = substr( self::$settings['files_path'], 0 - 1 ) == "/" ? self::$settings['files_path'] : self::$settings['files_path']."/";
        self::$settings['script_url'] = self::$settings['using_mod_rewrite'] ? self::$settings['base_url'] : self::$settings['base_url']."index.php/";
        require_once( BASE_PATH."library/functions.php" );
        self::getrequestparams( );
        self::$input = Functions_Text::retrieveinput( $_GET );
        self::$input = array_merge( self::$input, Functions_Text::retrieveinput( $_POST ) );
        if ( self::$settings['locale'] )
        {
            Functions_Text::setlocale( self::$settings['locale'] );
        }
        if ( !file_exists( BASE_PATH."library/database/".strtolower( self::$settings['sql_engine'] ).".php" ) )
        {
            exit( "Unsupported database engine specified: ".strtolower( self::$settings['sql_engine'] ) );
        }
        require_once( BASE_PATH."library/database.php" );
        require_once( BASE_PATH."library/database/".strtolower( self::$settings['sql_engine'] ).".php" );
        $_databaseClass = "Core_Database_".strtolower( self::$settings['sql_engine'] );
        self::$classes['database'] = new $_databaseClass( );
        require_once( BASE_PATH."library/session.php" );
        $_sessionClass = "Core_Session";
        if ( file_exists( BASE_PATH."interface/sso.php" ) )
        {
            require_once( BASE_PATH."interface/sso.php" );
            $_sessionClass = "Session_Sso";
        }
        self::$classes['session'] = new $_sessionClass( );
        self::$member = self::$classes['session']->getMemberData( );
        self::$secureKey = md5( self::$member['user_id'].self::$member['user_login_key'].self::$member['user_joined'] );
        require_once( BASE_PATH."library/output.php" );
        self::$classes['output'] = new Core_Output( );
        self::checkforbanned( Registry::getipaddress( ), "ip" );
        if ( self::$member['user_banned'] || self::$member['user_group'] == self::$settings['banned_group'] )
        {
            Registry::getclass( "output" )->printError( Functions_Text::getstring( "banned_message", "errors" ) );
        }
    }

    public static function getInstance( )
    {
        if ( !self::$instance )
        {
            self::$instance = new Registry( );
        }
        return self::$instance;
    }

    public static function getClass( $class )
    {
        if ( !array_key_exists( $class, self::$classes ) )
        {
            return null;
        }
        return self::$classes[$class];
    }

    public static function getRequestParams( )
    {
        $url = isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ? "https://" : "http://";
        $url .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
        $clean = str_replace( self::$settings['base_url'], "", $url );
        if ( strpos( $clean, "index.php/" ) === 0 )
        {
            $clean = substr( $clean, 10 );
        }
        if ( !$clean )
        {
            $controller = "index";
            $module = "";
            $action = "";
        }
        else
        {
            $additional = "";
            if ( strpos( $clean, "?" ) !== false )
            {
                $additional = substr( $clean, strpos( $clean, "?" ) );
                $clean = substr( $clean, 0, strpos( $clean, "?" ) );
            }
            $param = explode( "/", $clean );
            $controller = $param[0] ? $param[0] : "index";
            $module = isset( $param[1] ) ? $param[1] : "";
            $action = isset( $param[2] ) ? $param[2] : "";
            if ( $additional )
            {
                $additional = substr( $additional, 1 );
                $params = explode( "&", $additional );
                foreach ( $params as $parameter )
                {
//					list( $k, $v ) = $k;
//					$_GET[$k] = $v;

                }
            }
        }
        $_GET['controller'] = $controller;
        $_GET['module'] = $module;
        $_GET['action'] = $action;
    }

    public static function getIpAddress( )
    {
        return $_SERVER['REMOTE_ADDR'];
    }

    public static function getRequestUri( )
    {
        return $_SERVER['REQUEST_URI'];
    }

    public static function checkForBanned( $data, $type, $return = false )
    {
        static $typesLoaded = array
        (
            "ip" => false,
            "email" => false,
            "username" => false
        );
        static $filters = array
        (
            "ip" => array( ),
            "email" => array( ),
            "username" => array( )
        );
        if ( !$return && $type == "ip" && Functions_Cookie::getcookie( "is_banned" ) )
        {
            Registry::getclass( "output" )->printError( Functions_Text::getstring( "banned_message", "errors" ) );
        }
        if ( !$typesLoaded[$type] )
        {
            Registry::getclass( "database" )->query( "SELECT * FROM %sbanfilters WHERE filter_type='".Registry::getclass( "database" )->escapeString( $type )."'" );
            while ( $_row = Registry::getclass( "database" )->getResult( ) )
            {
                $filters[$type][] = $_row['filter_value'];
            }
        }
        if ( count( $filters[$type] ) )
        {
            foreach ( $filters[$type] as $_filter )
            {
                $_filter = preg_quote( $_filter, "#" );
                $_filter = str_replace( "\\*", ".*?", $_filter );
                if ( preg_match( "#".$_filter."#i", $data ) )
                {
                    if ( $return )
                    {
                        return true;
                    }
                    if ( !$return && $type == "ip" )
                    {
                        Functions_Cookie::setcookie( "is_banned", 1, "*" );
                    }
                    Registry::getclass( "output" )->printError( Functions_Text::getstring( "banned_message", "errors" ) );
                }
            }
        }
        return false;
    }

    public static function checkSecureKey( $key = "" )
    {
        $key = $key ? $key : self::$input['key'];
        if ( !Functions_Text::validatemd5( $key ) )
        {
            self::getclass( "output" )->printError( Functions_Text::getstring( "bad_secure_key", "errors" ) );
        }
        if ( $key != self::$secureKey )
        {
            self::getclass( "output" )->printError( Functions_Text::getstring( "bad_secure_key", "errors" ) );
        }
        return true;
    }

    public static function getSecureKey( )
    {
        return self::$secureKey;
    }

}

?>

controller.php

<?php

class Controller
{
    public static function initialize( )
    {
        $registry = Registry::getinstance( );
        $controller = preg_replace( "#[^a-zA-Z0-9_]#", "", Registry::$input['controller'] ? preg_replace( "/(.+?)\\.([a-zA-Z]{2,3})/", "\\1", Registry::$input['controller'] ) : "index" );
        if ( !file_exists( BASE_PATH."controllers/".$controller.".php" ) )
        {
            if ( Registry::$settings['using_tiny_urls'] )
            {
                Registry::getclass( "database" )->query( $Tmp_29."' LIMIT 1" );
                $file = Registry::getclass( "database" )->getResult( );
                if ( $file['file_id'] )
                {
                    if ( preg_match( "/(.+?)\\.(.+?)/", Registry::$input['controller'] ) )
                    {
                        Registry::$input['do'] = "thumbnail";
                    }
                    Registry::getclass( "database" )->query( "SELECT * FROM %susers WHERE user_id=".$file['file_user'] );
                    $user = Registry::getclass( "database" )->getResult( );
                    require_once( BASE_PATH."controllers/files.php" );
                    $classname = "controller_files";
                    if ( file_exists( BASE_PATH."interface/extend_files.php" ) )
                    {
                        require_once( BASE_PATH."interface/extend_files.php" );
                        $classname = "Extended_Class";
                    }
                    $action = new $classname( );
                    $action->setUser( $user );
                    $action->setFile( $file );
                    $action->dispatch( );
                }
            }
            $controller = "index";
        }
        require_once( BASE_PATH."controllers/".$controller.".php" );
        $classname = "controller_{$controller}";
        if ( file_exists( BASE_PATH."interface/extend_".$controller.".php" ) )
        {
            require_once( BASE_PATH."interface/extend_".$controller.".php" );
            $classname = "Extended_Class";
        }
        $action = new $classname( );
        $action->dispatch( );
        Registry::getclass( "output" )->printOutput( );
    }
}

?>

No Meu server os Arquivos Htacess fika Oculto! mais vo postar ele assim msm:

<IfModule mod_rewrite.c>
RewriteEngine On

# Change this to the path to Upload Script
# Use / if US are at the front of your site
RewriteBase /uploads/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change it here too
RewriteRule . /uploads/index.php [L]

</IfModule>

Compartilhar este post


Link para o post
Compartilhar em outros sites

bom amigo, acho que você entendeu algo errado. eu nunca disse que iria fazer pra você

este é um fórum que auxilia os usuários os ajudando com SEUS scripts

e isso ai é um sistema MVC, caso queira apta-lo vai ter que aprender

MVC é algo bem complexo

 

e caso seja iniciante em programação

acho melhor começar do básico:

http://blog.thiagobelem.net/upload-de-arquivos-com-php/

http://codigofonte.uol.com.br/codigo/php/arquivos/fazendo-upload-de-arquivos-com-php

http://ajuda.uolhost.com.br/index.php?p=resposta&res=629#rmcl

Compartilhar este post


Link para o post
Compartilhar em outros sites

Mais eu nao pedi pra voçe faz como nao tem comoe u postar todos os codigos eu mandei o link porque achoq eu deve ser em algum codigo daquele que sla nao ta salvando so arqvs na pasta entao quero um auxilio pra resolver este poblema!

Compartilhar este post


Link para o post
Compartilhar em outros sites

ao meu ver está parecendo mais um erro de configuração dos arquivos. mas daria um belo trabalho pra arrumar isso (principalmente sem um erro espécifico)

 

como eu coloquei acima eu aconselho você fazer um sistema de upload você mesmo (nada dificil de fazer)

 

dá uma olhada nos links acima

e nos abaixo:

http://www.upinside.com.br/codigo-pronto/upload-multiplo-com-cadastro-em-banco-de-dados-php-e-jquery

http://www.upinside.com.br/video-aulas/multiplo-upload-com-cadastro-em-banco-de-dados-e-alteracao-do-nome-do-arquivo

http://www.upinside.com.br/video-aulas/upload-de-imagens-aula-1-upload-redimensionamento-e-renome-de-imagem

Compartilhar este post


Link para o post
Compartilhar em outros sites

Muito Obrigado Pelos Links e Pela Sua Atençao e Paciencia Comigo :)



Ultima Pergunta Voçe me ajuda a Por Exemplo eu tenho um Link direto ( http://www.exemplo.com/01.rar ) So que deste Link direto Quero Fazer um Link Que nao seja direto deste Link direto Exemplo: ( http://www.exemplo.com/de5e1we5rew56re4w1 ) Entende ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

isso ai é bem fácil:

 

você terá que estar cadastrando o código de acesso no banco juntamente com o endereço real

 

depois é só usar o código para puxar o arquivo real pra download

 

isso tudo ocorre sem o usuário notar

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.