PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ngilio   Simple upload class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Show how to use uploadclass
Class: Simple upload class
Validate and process an uploaded file
Author: By
Last change:
Date: 6 years ago
Size: 994 bytes


Class file image Download

if(isset($_POST["Send"])){ // If form is submited
$file=$_FILES["fileField"]; // Get file from form
        if (!
file_exists($destination)) { // If 'destination' folder dosn't exist, create

$process=new Upload($destination); // Set 'destination' as new default destination folder for upload
$uploadResult=$process->executeUpload($file); // Attach file to upload process
echo $uploadResult;

<form action="?" method="POST" enctype="multipart/form-data">
    <table id="dyntable" class="table table-bordered">
                <input type="file" name="fileField" id="fileField" placeholder="">
            <td colspan="2">
                    <button type="submit" name="Send">Send</button>
                    <button type="reset">Reinitialiser</button>