Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    131
    Member #
    13656
    Hey All!!I need to create an upload page for my site. The page's function basically is to upload text and a few files to individual client directories or records via a mySQL database. How would I go about doing this?~darknailblue
    Christopher Carvache
    Web Developer / SEO
    Northeast Web Design
    +1.860.906.7802

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,733
    Member #
    5580
    Liked
    718 times
    Well, I wish I had the knowledge to provide an actual script, maybe someone
    else can ... but I would have to ask if you've already tried finding your answer
    on Google:

    http://www.google.com/search?q=php+u...al&btnG=Search

    The very first one on the search find looks like it pretty much say it all.
    I didn't try it though. See if any of those tutorials can get you started.


  4. #3
    Junior Member
    Join Date
    Sep 2006
    Location
    UK
    Posts
    29
    Member #
    13854
    I wrote a similar script for the control panel of my blogging system. Here's how I did it:

    PHP Code:
    # code to upload file
    if (isset($_POST['upload'])) {
        
    $path "../content/" basename($_FILES['filename']['name']);
        
    $_FILES['filename']['tmp_name'];
        if (
    move_uploaded_file($_FILES['filename']['tmp_name'], $path)) {
            echo 
    "File \"" basename($_FILES['filename']['name']) . "\" has been uploaded successfully.<br /><br />";
        } else {
            echo 
    "There was a problem uploading the file. Please try again.<br /><br />";
        }
    }

    if (isset(
    $_GET['action']) && isset($_GET['file'])) {
        if (
    $_GET['action'] == "del") {
        
            if (!isset(
    $_GET['confirm'])) {
                echo 
    "<Are you sure that you want to delete file \"" $_GET['file'] . "\"?";
                echo 
    "[ <a href=\"files.php?action=del&file=" $_GET['file'] . "&confirm=yes\">Yes</a> | <a href=\"files.php\">No</a> ]";
                die(include(
    "includes/page_bottom.htm")); # then display bottom part of page but go no further
            
    }
            
            
    $filename "../content/" $_GET['file'];
            
    unlink($filename);
            
    $del_success 1;
        }

    The HTML input field is of the 'file' type, which I was previously unaware of:

    <input type="file" name="filename" value="Browse..." />

    This information is posted the PHP script. The script validates the POSTed data and uploads the file, if appropriate. If you want to delete a file from the server you send some info to the script using GET, like so:

    file.php?action=del&file=whatever.gif

    Obviously you'll need to adapt the script to make it work in the way that you want, but hopefully this should set you on the right path. Let me know if you need any help and I'll see what I can do.

  5. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    131
    Member #
    13656
    This seems to be a great start... I'll let you know how it works out.
    ~darknailblue
    Christopher Carvache
    Web Developer / SEO
    Northeast Web Design
    +1.860.906.7802


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:08 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com