Rabu, 28 Oktober 2015

Php How To Move Uploaded File To Another Folder

Php Code To Move Uploaded File To Another Directory


________________________________________________________


In this Php Tutorial we will see How To Move Uploded File To Another Folder Using Php .

I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .


 




Php Source Code:

<?php

if(isset($_POST['moveFile']))
{
    $fileName = $_FILES['fileName']['name'];
    $tempName = $_FILES['fileName']['tmp_name'];
    
    if(isset($fileName))
    {
        if(!empty($fileName))
        {
            $location = "MyFilles/";
            if(move_uploaded_file($tempName, $location.$fileName))
            {
                echo 'File Uploaded';
            }
        }
    }
}

?>

<!DOCTYPE Html>
<html>
    <head>
        <title> PHP MOVE FILE </title>
    </head>
    <body>
    
        <form action="php_move_upload_file.php" method="post" enctype="multipart/form-data">
            <input type="file" name="fileName"><br><br>
            <input type="submit" name="moveFile" value="Upload">
        </form>
        
    </body>
</html>




php move file
                     

Bagikan

Jangan lewatkan

Php How To Move Uploaded File To Another Folder
4/ 5
Oleh

Subscribe via email

Suka dengan artikel di atas? Tambahkan email Anda untuk berlangganan.