Upload a file in Php

Upload a file in Php

Upload a file in Php
Upload file in Php



HTML CODE
<form action='xmlupload.php' method='POST' enctype="multipart/form-data">
    <span> <input type="file" name="userfile"  >
    <input type='submit'  name="submit"></span>
</form>


PHP CODE

    $uploaddir = '/var/www/html/tmadmin/uploads/';
    $uploadfile = $uploaddir.basename($_FILES['userfile']['name']);

    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        echo "File is valid, and was successfully uploaded.\n";
    } else {
        echo "Upload failed";
    }

    print_r($_FILES);

0 Response to "Upload a file in Php"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel