Uploading Files With PHP

Uploading Files With PHPUpload an image or file to your server without using your FTP.

Step 1: Open a web editor, then paste this

<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
File: <input type="file" name="file" size="30"> <input type="submit" value="Upload!">
</form>

Then save it as form.php

Step 2: Open a web editor once again, and paste this code:

<?php
$uploaddir = "uploads"; // Where you want the files to upload to
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
}
print "Your file has been uploaded successfully!";
?>

Save it as upload.php

Step 3: Upload these to files onto your website using any ftp program.

Step 4: Upload a folder called uploads and CHMOD it to 0777

Your Done!


Related Articles

  • Introduction to .htaccess
    .htaccess is a Unix/Linux based file for Apache web servers that allow you to change access permissions and many other things for files on your web server.
    To make a .htaccess file, open up an html editor, preferably notepad, and enter your commands(each on a seperate line). When saving your file...
  • Introduction to FTP
    FTP stands for File Transfer Protocol and is a standard application protocol that uses the Internet
  • IP Banning
    1. Make a new text file and name it .htaccess or open one you already have.
    2. Find out the persons IP address and substitute it for 000.000.000.000.
    To deny access..
    deny from 000.000.000.000
    To allow access..
    allow from 000.000.000.000
    To ban everyone..
    deny from all
    To add mor....
  • Web Hosting and Types of Web Hosting
    While most of us can design a website and upload any information, news, bulletins, images, files and documents (incl. HTML files, CSS files, graphic files, java scripts etc.), to make the same available for public viewing we need to copy the site to a public server....
  • Changing Web Hosting Providers
    If you would like to cut costs or are no longer satisfied with their current web host provider maybe it is time to think about changing web host providers. Take time to plan your transfer so that you wont lose any files and data...
  • Prevent Directory Listing
    Whenever you have folders with large amounts of files or important administration files, it is essential to prevent directory listings, otherwise all of the files in the folder will be listed to anyone who wants to see them, including hackers. When hackers can find an administration file, it makes t...
  • Advanced File Uploader
    1. This allows users to upload files to your server in a specific folder, with a specific file size, with a specific allowed extension list, and more....
    2. Copy/paste this code on the page you want People to go to in order to upload
  • Creating a Robots.txt file
    Some people believe that they should create different pages for different search engines, each page optimized for one keyword and for one search engine. Now, if you do decide to create such pages, there is one issue that you need to be aware of...
  • Can You Update Your Own Web Pages?
    Tired of paying people to update your website? Quit wasting cash. Learn to do it yourself with this great tutorial.
  • What is FTP?
    In the past I have defined many Web hosting jargon words that have sent many people to scratching their heads and calling upon the mighty powers of Google to look for an answer. Today I have one more for you. How many times have you hear of somebody saying they needed to FTP something?...

Contact Web Design Outsource and get started today

Need Website Designing, Development, Redesigning, Maintenance and SEO services or help growing your company's web presence? Request a free Quote Now.