WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Complete upload scripts to upload three files and you can extend it. Upload files system
Categories : PHP, Filesystem Update Picture
Raj Shrestha
Date : Nov 22nd 2001
Grade : 3 of 5 (graded 5 times)
Viewed : 8865
File : upload1.php
Images : No Images for this code example.
Search : More code by Raj Shrestha
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/*****************************************************************************
This program is written by rajendra kumar shrestha and email is rajensama@yahoo.com
If you have any problem you can see the code demo in www.rajensama.com
The upload system contains twofiles. To use this uploading files you have to
the following things first.
1. separate files upload1.php and upload2.php  then upload to your web server.
You can put these two files in any directory but both of them should be in same
direcotry
in the same
2. create a directory called "uploaded" in the document root
3. set the chmod to the directory as 777
4.Repalce the directory
      c:/program files/apache group/apache/htdocs/ with your document root and
      similarly if it is in linux   , replace this
      /usr/local/httpd/htdocs/kunden/web269/html with document root.
      For document root see the phpinfo file or create a file with
      phpinfo() function.
5.
*****************************************************************************/
?>
<html>
<head>
<TITLE>Uploading files</TITLE>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<meta NAME='Description' content="Uploading files ">
</head>
<body>


<table width="659" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="659" height="954" valign="top">
      <table width="90%" border="1" bgcolor="#FFCC99">
        <tr>
          <td bgcolor="#FFCC66">
            <div align="center"><b><font size="4">Please fill the following details
              to upload the files</font></b></div>
          </td>
        </tr>
      </table>
      <form action="upload2.php" method="post" enctype="multipart/form-data">

      <table width="90%" border="0">
        <tr>
          <td width="30%">Filename(Attach file)</td>
          <td colspan="2" width="70%">
             <input type="hidden" name=MAX_FILE_SIZE value=1000000>
             <input type="file" name="userfile[]"><br>
             <input type="file" name="userfile[]"><br>
             <input type="file" name="userfile[]" ><br>

          </td>
        </tr>
        <tr>
          <td colspan="3">
            <input type="submit" name="submit" value="Submit Details">
            <input type="reset" name="Submit2" value="Reset">
          </td>
        </tr>
      </table>

      </form>
    </td>
  </tr>
</table>
</body>
</html>



upload2.php
<html>
<head>
<TITLE>Uploading files </TITLE>
</head>
<body>

<?
if($submit)
{
    for(
$i=0; $i<3; $i++)
         {

         if(
is_uploaded_file($userfile[$i]))
            {
              print(
"<BR>");
              print(
"userfile[$i]=$userfile[$i] ");
              print(
"Actual file name is $userfile_name[$i] ");

              if (
is_uploaded_file($userfile[$i]))
              {


 
//This lines copies the temporary files to   the specified directory and
  //renames it to original name
  //here      /usr/local/httpd/htdocs/kunden/web269/html is document root .
  //You have to replace the document root part with the docuemnt root of your server
  //which you can see using phpinfo() function
  //   Then create a directory called  "uploaded" and assign chmod value of 777
  //to this directory
  //This is where most of the novo programmer fails
  // Because PHP upload the file and deletes immediately so we have to
  //copy before it deletes
   //This is , I have used with linux
  //copy($userfile
[$i], "/usr/local/httpd/htdocs/kunden/web269/html/uploaded/".$userfile_name[$i]);
 
//This is , I have used with windows
 
copy($userfile[$i], "c:/program files/apache
group/apache/htdocs/uploaded/"
.$userfile_name[$i]);

              }
              else
              {
                  echo
"Possible file upload attack: filename '$userfile'.";
              }
            }
            else
            {
             print(
"<BR>");
            print(
"file not uploaded");
            }

         }
}

?>
</body>
</html>



Convert a File database into MySQL
Categories : PHP, Filesystem, Databases, MySQL, Beginner Guides
Remote File Size
Categories : PHP, Filesystem, HTTP, Sockets
Quote For the Day
Categories : PHP, Utilities, Filesystem
How to ifconfig down/up a list of IP's
Categories : Arrays, Strings, Filesystem, PHP
Variable serialization and unserialization. Loading and saving variable structures to and from file.
Categories : Arrays, Filesystem, Variables, Strings, PHP
Finds files on your site, uses UNIX find command.
Categories : Complete Programs, Filesystem, PHP
Introduction to Language Files
Categories : PHP, Filesystem, Beginner Guides
Get the correct extension and MIME types of an image, even when the filename is incorrect.
Categories : PHP, Filesystem, General SQL
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP
JSON File Upload
Categories : PHP, AJAX, Filesystem
include php3 files
Categories : Filesystem, PHP, Apache, Web Servers
A flat file counter
Categories : PHP, Cookies, Filesystem, Beginner Guides
Upload function using PHP's FTP abilities.
Categories : PHP, Filesystem, FTP
grab directory listings into an array the example prints out each subdirectory in the main dir - further work is to be performed on this one
Categories : Filesystem, PHP, Directories, Search, Utilities
a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts
Categories : PHP, URLs, Directories, Filesystem