Forums

file upload/browse (2 posts)

  1. davedekker
    Member
    Posted 5 years ago #

    I placed some php code on a template page so it has a file upload function, it calls upload.php so I can upload any file I want to an upload directory, the script works outside of wordpress, but not within a wordpress page. any ideas? code is listed below. Like I said it is basic and works correctly on its very own PHP page, but I would like a page within wordpress for this... and someday beable to browse where I want to upload the file to, but one step at a time... function like "PHP Advanced Transfer Manager" within word press would be the gold... http://phpATM.free.fr

    the script I placed in the page is:

    <form action="upload.php" method="post" ENCTYPE="multipart/form-data">
    File: <input type="file" name="file" size="30"> <input type="submit" value="Upload!">
    </form>

    and my code for upload.php is

    <?php
    // ==============
    // Configuration
    // ==============
    $uploaddir = "upload"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777!
    // ==============
    // Upload Part
    // ==============
    if(is_uploaded_file($_FILES['file']['tmp_name']))
    {
    move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
    }
    print "Your file has been uploaded successfully! Yay!";
    ?>

  2. Bernard Bos
    Member
    Posted 5 years ago #

    How do you display the file name, when it is uploaded?

    something like `print "$_FILES['file']['name']";

    Can you help me?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.