• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Freeware/low cost uploader"

Collapse

  • Tevh
    replied
    It isn't made very clear on the website as the HTML markup hasn't been included in the code box. What you should do is copy the complete thing, like this: (I've also added the <html> tags as these were missing from the original script)

    Code:
    <?php 
    
    $max_size = 15; //Your maximum file size(in mb); 
    $direc_copy = "uploads/"; //Directory to copy to 
    //Seperate with a comma 
    $accepted_file_list = "video,image"; // the files types you will allow to be copied, Possible options are: 
    //text,image,audio,video,application 
    
    $accepted_file_list = explode(",",$accepted_file_list); 
    $max_size = (($max_size * 1024) * 1024); 
    $submit = $_POST['submit']; // get the submit 
    if (isset($submit)){ 
           $filename = $_FILES['file_upload']; //get the file details 
        $mime_type = explode("/", $filename['type']); //get the first bit of the mime type 
         if (($filename['size'] > 0) and ($filename['size'] < $max_size)){ //check if a file actually exists. 
            if (in_array($mime_type[0], $accepted_file_list)){//check if the file is in the accepted_file_list array 
                copy($filename['tmp_name'], $direc_copy . $filename['name']); // copy the file 
                $message = "Your file has been uploaded."; //message if copied 
                }  
                else { 
                    $message = "Filetype not supported"; //message if filetype not supported 
                    } 
            } else { 
                $message = "File is outside of the allowed boundaries"; 
                } 
    } 
    ?> 
    
    <html>
    <head>
    </head>
    <body>
    
    <form action="uploader_test.php" method="post" enctype="multipart/form-data" name="fileuploader" id="fileuploader">
    <input type="file" name="file_upload" id="file_upload">
    <input type="submit" name="submit" value="submit">
    </form>
    
    <?php echo($message . "<br>" . "The link is " . $direc_copy . $filename['name']); ?> 
    
    </body>
    </html>
    You would copy and paste all of the code into a plain text document and save with a filename of 'uploader_test.php' then upload it. Also make sure you have a folder called 'uploads' in the same directory as the script.


    HTH

    Leave a comment:


  • AtW
    replied
    echo function will send data to final generated HTML.

    Leave a comment:


  • xoggoth
    started a topic Freeware/low cost uploader

    Freeware/low cost uploader

    Doing a village website and want a server side uploader where others can upload stuff via simple HTML form. There's a sample on here:-

    http://www.codingforums.com/showthread.php?t=123020

    Not knowing a thing about server side stuff I did not quite follow the last line headed
    PHP Code:
    <?php echo etc

    Does that go in the HTML or what?

    Cheers

Working...
X