How to Upload Files with PHP
How to Upload Files with PHP
This tutorial will cover how to make a basic PHP upload script. You can easily convert or change it.
You need a PHP enabled host, the ability to upload, and HTML or PHP knowledge to change the script around to fit your needs
This is the basic code:
is_uploaded_file($_FILES["userfile"]["tmp_name"])) { copy($_FILES["userfile"]["tmp_name"], "$/images/" . $_FILES["userfile"]["name"]); echo "<p>File uploaded successfully.</p>"; } ?>
|
You can change the "/images/" to any directory you want.
You may also want to password protect the file. This is so only webmasters or selected people can view it.
About the author
Written by Darren W..
Darren Hedlund is a freelance Web developer, writer, and data analyst. Darren has a degree in Computer Information Science and has spent the last 15 years developing application and environments from hand held, windows, web, virtual science, gaming, artificial intelligence and graphics design.
Darren's coding knowledge ranges from C+, Visual Basic, .NET, PHP, JSP, REXX, KIXX, and many others. His graphical and environmental knowledge stems in Macromedia Flash, 3D studio Max, Curious Labs Poser, Adobe Photoshop, and many others. Darren works in many platforms ranging from database, visual design, and, system development.
If you found this post useful you may also want to check these out:
- How To Upload Files Using PHP
- Text Configuration Files and XML
- Tip: Create Multiple Files in XSLT 2.0
- Controlling Core Files (Linux)
- Using PHP 4s DOM XML Functions to Create XML Files from SQL Data
- Creating and Linking External CSS files