File Manipulation Code

  Home arrow File Manipulation Code arrow multiple file uploader
FILE MANIPULATION CODE

multiple file uploader
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-06-02

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    i never really got around to finishing this one but thought someone could use it. it uploads multiple files to the specified directory and allows you to rename the file as well, however, it will NOT check the file type being uploaded so you'd probably want to add that little feature before letting anyone use it publicly.. and it won't check for overwriting either..

    By : tapeworm byte

    <?php

    $maxsize = "200000";
    $path = "/full/path/to/my/directory/";

    if($uploads <= 1)
    {
    $uploads = 5;
    }
    $fields = $uploads + $uploads;

    for($n = 0; $n < $uploads; $n++)
    {
    if($uploadedFile[$n] != "" && $uploadedFile[$n] != "none")
    {
    copy("$uploadedFile[$n]", "$path$uploadedFile_name[$n]");
    rename("$path$uploadedFile_name[$n]", "$path$fileName[$n]");
    if(file_exists("$path$fileName[$n]"))
    {
    print("upload successful for $fileName[$n] - $uploadedFile_size[$n] bytes<br>\n");
    }
    else
    {
    print("error: upload failed<br>\n");
    }
    }
    }

    print("<form action=\"$PHP_SELF\" method=\"POST\" enctype=\"multipart/form-data\">\n");
    print("<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$maxsize\">\n");
    print("<table border=\"0\" cellpadding=\"0\" cellspacing=\"3\"><tr><td>\n");
    print("<b>Name:</b></td><td>\n");
    print("<b>File Location:</b></td></tr>\n");

    for($i = 1; $i <= $uploads; $i++)
    {
    print("<tr><td><input type=\"text\" name=\"fileName[]\" value=\"example$i.jpg\" size=\"13\"></td><td>\n");
    print("<input type=\"file\" name=\"uploadedFile[]\" size=\"25\"></td></tr>\n");
    }

    print("<tr><td align=\"center\"><input type=\"submit\" value=\"UPLOAD\"></td><td>\n");
    print("<a href=\"$PHP_SELF?uploads=$fields\">More Upload Fields</a></td></tr>");
    print("</table>\n");
    print("</form>\n");

    ?>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More File Manipulation Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    FILE MANIPULATION CODE ARTICLES

    - Bandwidth Control with pure PHP
    - Eazy Gallery
    - file_get_contents for PHP < 4.3.0
    - PHP Class: Image Snapshot 1.3
    - Universal downloader
    - Image Gallery v2.0
    - Free/Used Disk Space
    - Directory Lister
    - Directory image view, with selective hidden
    - Move or Copy a Directory (and files and sub ...
    - Ensure_Sub_Directory_Exists
    - Wedit
    - Form Examples Text Boxes to Drop Downs
    - myFiles
    - List files in a directory, no subdirectories


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap