Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 01-19-2010, 09:43 PM   #1 (permalink)
Tharaka Deshan
Junior Member
 
Join Date: Jan 2010
Posts: 13
Default PHP script to Upload file

This is a very simple code to upload file to your server.

page1.html

<html>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input name="file" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>
</html>


upload.php

<?php
$target = basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target)){
echo "Success!";
}else{
echo "failed!";
}
?>


Note:Make sure to set path folders write permission.
Tharaka Deshan is offline   Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View:
Points Per Thread:
Points Per Reply:



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 04:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums