This is a very simple, working example of a file upload. I provide the php code to handle an arbitrary number of file uploads, and example html code.
Download
View Source (print view)
Rating : 4.7
Views : 343
> HTML code:
> -----------
> <FORM ENCTYPE="multipart/form-data" ACTION="submit.php" METHOD=POST>
>
> <input type=file name=files[] size=20>
>
> <input type=submit value="Upload File">
>
> </FORM>
>
> submit.php:
> -----------
> <?php
>
> $path_to_file = // enter the directory you want file uploaded to here
>
> // file upload code
> // it expects the inputs of type file to be named 'files[]'
> // it will work with an arbitrarily large number of files
> $files = $HTTP_POST_FILES['files'];
> if (!ereg("/$", $path_to_file))
> $path_to_file = $path_to_file."/";
> foreach ($files['name'] as $key=>$name) {
> if ($files['size'][$key]) {
> // clean up file name
> $name = ereg_replace("[^a-z0-9._]", "",
> str_replace(" ", "_",
> str_replace("%20", "_", strtolower($name)
> )
> )
> );
> $location = $path_to_file.$name;
> while (file_exists($location))
> $location .= ".copy";
> copy($files['tmp_name'][$key],$location);
> unlink($files['tmp_name'][$key]);
> // $content .= "Uploaded File: ".$location."n";
> $thanks .= "n<br>Successfully uploaded file: $name.";
> }
> }
> print "<h1>File Submission</h1>n";
> print $thanks;
>
> ?>
php script" class="neww" target="_b, how to use this code, php_tools, yahoo_status_shopping_cart.php, php file upload, shopping_cart and user=0--, drop down, mysql_commit, forum, shopping_cart', backup, updateoraddimagesonpages, rtttl to 8 bit source code, stefan_hornea, rent_and_0=1_union_select, how to run php, php_script"_class="neww"_target="_blank"_title="im_neuen, embed_snippets, farah_aead, sql incection, antoine anik