SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP ME PLZ!! - Uploading to server!

    I'm geting this error message!!

    Warning: move_uploaded_file(../public_ftp/fotos/avatar36459_19.gif): failed to open stream: Permission denied in /home/lisbon/domains/lisbonxtyle.com/public_html/index.php on line 425

    Warning: move_uploaded_file(): Unable to move '/tmp/phpvl26D5' to '../public_ftp/fotos/avatar36459_19.gif' in /home/lisbon/domains/lisbonxtyle.com/public_html/index.php on line 425
    Ocurreu um erro! O ficheiro pode ja existir ou ent�o possui caracteres invalidos como o "�".
    with this code:

    PHP Code:
    [...]
    $grupo=$_POST['T1'];
        
    // Where the file is going to be placed 
    $target_path "fotos/";
    $query'INSERT INTO grupos_fotos (nome,data) values("'.$grupo.'","'.date("Y-m-d H:i:s").'")';

    $teste=mysql_query('select id from grupos_fotos where nome="'.$grupo.'"');
    $existe=mysql_fetch_row($teste);

    if(
    $existe[0]!=''){$getgrupoid mysql_query('select id from grupos_fotos where nome="'.$grupo.'"');}
    else{
        
    mysql_query($query); 
    $getgrupoid mysql_query('select id from grupos_fotos where nome="'.$grupo.'"');}

    $grupoid=mysql_fetch_row($getgrupoid);

    if(
    $grupoid[0]==''){die();}

    /* Add the original filename to our target path.  
    Result is "uploads/filename.extension" */
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 

    $extencao explode("."$target_path);

    if(
    $extencao[1]=='jpeg' || $extencao[1]=='jpg' || $extencao[1]=='gif' || $extencao[1]=='GIF' || $extencao[1]=='JPG' || $extencao[1]=='JPEG') {

    if(
    move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        
        
    mysql_query('INSERT INTO fotos (nome,grupo) VALUES ("'.basename$_FILES['uploadedfile']['name']).'","'.$grupoid[0].'")');

        echo 
    '<head><meta http-equiv="refresh" content="10;index.php?mestre=9&red=22"/></head><body><p align=center>O ficheiro '.  basename$_FILES['uploadedfile']['name']). 
        
    ' foi adicionado!</p></body>';
    }else{
        echo 
    '<head><meta http-equiv="refresh" content="10;index.php?mestre=9&red=22"/></head><body>Ocurreu um erro! O ficheiro pode ja existir ou então possui caracteres invalidos como o "ç".</body>';
    }
    }else{echo 
    '<head><meta http-equiv="refresh" content="10;index.php?mestre=9&red=22"/></head><body><p align=center>O ficheiro '.basename$_FILES['uploadedfile']['name']).' não é uma imagem JPEG ou GIF...</p></body>';}
    }

    [...] 
    No matter what picture i put....


    But in my PC it works fine!

  2. #2
    Once I was a Factory Worker goofy's Avatar
    Join Date
    Dec 2004
    Location
    Sydney Australia
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe your permissions on your server don't allow you to move files, in which case you'll need to change the permission settings. Is your server Linux or Windows IIS?
    Goofy
    Life is what you make it!
    Follow your dreams!

  3. #3
    SitePoint Addict Procode's Avatar
    Join Date
    Dec 2006
    Location
    New York
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "/fotos" need to be CHMOD to 777.

  4. #4
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not the real Admin of the server, i bought it on the internet.

    Quote Originally Posted by Procode View Post
    "/fotos" need to be CHMOD to 777.
    Can you be more specific? What is CHMOD and how can i solve this?

    Thanks!

  5. #5
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lambda,

    can you ftp to the folder that you are attempting to upload to? If so, change the permissions to 777 for that folder.
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.

  6. #6
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh Yes!!! It Works!!! Thanks! :d

    Edit: There's another prob, the picture is on the server now, but i cant direct link it... it doesnt show it.

  7. #7
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you give some more details? What do you mean you cant link to it? What is the full path to the image? ie Where you uploaded to?
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.

  8. #8
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.lisbonxtyle.com/index.php

    Here's the main link.


    Here's the problem:
    http://www.lisbonxtyle.com/index.php?folder=3

    here's the page i use to configure the server:


    I dont get any error messages now while uploading pictures, its just that i cant access them as you can see in the 2nd link i gave.

  9. #9
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i notice that you are uploading to the public_ftp folder.....I normally have a folder called images or similar inside the public_html folder.....I am not sure if this makes any difference - its hard to tell as I am not sure what your code to display them looks like...Can you post some of that perhaps?
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.

  10. #10
    Non-Member Lambda's Avatar
    Join Date
    Sep 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Exactly!!
    The public_html works perfectly!!!!

    Btw, the code i used is up there on the 1st post, just change the targetfolder to yours if you want to use it , any question about it ask me.

    Btw, can you solve me this problem?
    http://www.sitepoint.com/forums/showthread.php?t=450080

    Thanks!!

  11. #11
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad to help (sorry didnt see your code above!)...

    Will take a look at the other posting now.
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •