Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Upload file via FTP

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not neccessarily... you can modify files that are on the server through php, but it is hard to do so, depending on complexity.
    Not via FTP, you can't.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franįais | entiendo espaņol | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #12
    Join Date
    Apr 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Someone tell me that with ftp continues upload a file to the end despite network problems and with http the upload breaks. Itīs true??

    One more question. Can I do an update query for change a file?
    The question isn't completely right. I will reformulate:

    Can I do an update query via ftp?

  3. #13
    Join Date
    Apr 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I don´t understand why doesn't update the register knowing that with a insert query works:

    PHP Code:
    if ($_POST["edit"] == "Alterar")
        {
                if (
    $_POST["titulo"] != "")
                {
                    
    // set up basic connection
                        
    $conn_id ftp_connect($ftp_server); 
                        
                        
    // login with username and password
                        
    $login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass); 
                        
                        
    // check connection
                        
    if ((!$conn_id) || (!$login_result)) { 
                               
    //echo "FTP connection has failed!";
                               
    echo "<script>alert('Ligação ao servidor FTP falhada.');</script>";
                               
    //echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
                               
    exit; 
                           } else {
                               
    //echo "Connected to $ftp_server, for user $ftp_user_name";
                           
    }
                        
                        
                        
    // upload the file
                        
    $upload ftp_put($conn_id$destination_file$source_fileFTP_BINARY); 
                        
                        
    // check upload status
                        
    if (!$upload) { 
                               
    $sql "update livros set imagem = '', titulo = '".$_POST["titulo"]."', autor = '".$_POST["autor"]."', ano = '".$_POST["ano"]."', editora = '".$_POST["editora"]."', link = '".$_POST["link"]."', link_text = '".$_POST["link_text"]."', descricao = '".$_POST["descricao"]."', cat_ID = '".$_POST["cat_ID"]."' where livro_ID = ".$_POST["livro_ID"];
                               echo 
    "<script>alert('Ficheiro actualizado com sucesso sem imagem.');</script>";
                           } else {
                                    if (
    is_file("../images/livros/".$_FILES['file']['name'])) {
                                    
    $sql "update livros set imagem = 'images/livros/".$_FILES["file"]["name"]."', titulo = '".$_POST["titulo"]."', autor = '".$_POST["autor"]."', ano = '".$_POST["ano"]."', editora = '".$_POST["editora"]."', link = '".$_POST["link"]."', link_text = '".$_POST["link_text"]."', descricao = '".$_POST["descricao"]."', cat_ID = '".$_POST["cat_ID"]."' where livro_ID = ".$_POST["livro_ID"];
                                    
    //echo " Actual query: " .$sql;
                                    
    echo "<script>alert('Ficheiro actualizado com sucesso.');</script>";
                                }
                               
    //echo "Uploaded $source_file to $ftp_server as $destination_file";
                           
    }
                        
                        
    // close the FTP stream 
                        
    ftp_close($conn_id); 
                }
                else
                {
                    echo 
    "<script>alert('Título obrigatório.');</script>";
                }
        } 

    Can you explain??

    NOTE: it confirms the updating but the register don&#180;t modify!!

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
  •