WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
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
Forex Trading Online forex trading platform

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 : 7400
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 
 

<?
/*****************************************************************************
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>



Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
The toll booth
Categories : PHP, Java Script, Filesystem
php jump urls...the best way
Categories : PHP, URLs, Filesystem
Simple way to replace a variable value in a .conf (.ini) file using a webbrowser - the first stage of a complete universal configuration editor
Categories : PHP, Regexps, Code Editors, Filesystem
Display list of files within current and subdirectories (recursively) showing each file as an anchored link and each directory as a category header.
Categories : Filesystem, Directories, Arrays, PHP
File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection.
Categories : Complete Programs, Content Management, Filesystem, PHP
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions
Remote File Saving with PHP - Download and serve a remote file. The content of the file will be updated at fixed intervals.
Categories : PHP, Filesystem, Cache, Sockets, HTTP
JSON File Upload
Categories : PHP, AJAX, Filesystem
Get the correct extension and MIME types of an image, even when the filename is incorrect.
Categories : PHP, Filesystem, General SQL
Read DPI value from image with PHP
Categories : PHP, Graphics, Filesystem
Simple pipe delimited file export program that downloads to a local machine
Categories : PHP, Filesystem, Databases, MySQL, HTTP
Single-file PHP news system with automatic folder structure creation
Categories : PHP, Filesystem, Arrays
Recursive function to move files on a filesystem. It can be minor changed in order to copy recursively.
Categories : PHP, Filesystem, Algorithms