FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Upload Script

 


NG
Step 1
Add this form in between your <body></body> tags:

Code:
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
Select a file <input type="file" name="userfile"><br>
<input type="submit" value="Upload!">
 

Step 2
Open a new file and copy the below code and save it as upload.php


Code:
<?php

if(!(copy($_FILES['userfile']['tmp_name'], "Upload/" . $_FILES['userfile']['name']))) die("Cannot upload files.");

echo "Upload Complete!";

?>
Ranfaroth
Some errors :
form elements can't have directly inline elements (like input). You need a block element (like fieldset)
Don't use copy for moving your file : you should use move_uploaded_file.
You should also use is_uploaded_file for security.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.