Jump to content

Zephni

Members
  • Posts

    109
  • Joined

  • Last visited

Posts posted by Zephni

  1. I have made a file explorer for my site so i can upload files, delete them and rename them. Everythings working fine except when i want to delete a folder. I realise you cant use ftp_delete, coz' that only works for files.

     

    I have tried rmdir, and even though I am getting no errors, it seems to do nothing :s So what is the best way to delete a folder and its contents using PHP FTP commands?

     

    Thanks guys

  2. I have a made a section on my site where I can upload files to a specific directory, rename them and delete them. So I don't have to go through a FTP program. When renaming and deleting a file I connect using FTP commands with PHP, except when uploading. When uploading it gets the file that has been uploaded from the form on the page before which has its own code using <input type="file"> to search for a local file, then when submit is clicked it uploads it. Then on my PHP script it moves that file from the temp upload folder to the actual site.

     

    Bottom line is, is there any way I can make a button that opens a file browser on the users PC and returns the filepath chosen? So I can use FTP to upload the file rather than the form?

  3. I have a made a section on my site where I can upload files to a specific directory, rename them and delete them. So I don't have to go through a FTP program. When renaming and deleting a file I connect using FTP commands with PHP, except when uploading. When uploading it gets the file that has been uploaded from the form on the page before which has its own code using <input type="file"> to search for a local file, then when submit is clicked it uploads it. Then on my PHP script it moves that file from the temp upload folder to the actual site.

     

    Bottom line is, is there any way I can make a button that opens a file browser on the users PC and returns the filepath chosen? So I can use FTP to upload the file rather than the form?

     

  4. Ok point taken, PHP should stay back end and not be fiddling around with front end scripting like JavaScript.  I should really search google and i most probably will after I have submitted this but what is the code to prompt with PHP or isn't there. Sorry for the noobishness, I am new to PHP (as you can see). Thanks for your replies guys.

  5. Hello! This bit of code actually does work, I just want to check that this is the best/proper/most efficiant way of doing it. Basically i'm calling a PHP function that uses the javascripts prompt function, then returning the value that the user types in back to PHP. Most probably easier to show you.

     

    <?php
    
    //prompt function
    function prompt($prompt_msg){
    	echo("<script type='text/javascript'> var answer = prompt('".$prompt_msg."'); </script>");
    
    	$answer = "<script type='text/javascript'> document.write(answer); </script>";
    	return($answer);
    }
    
    //program
    $prompt_msg = "Please type your name.";
    $name = prompt($prompt_msg);
    
    $output_msg = "Hello there ".$name."!";
    echo($output_msg);
    
    ?>
    

     

    That is the entire code, I just want to know if this is the proper way to do something like this (using javascript and PHP together) thanks guys!

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.