PHP script to Upload file - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-19-2010, 10:43 PM   #1 (permalink)
Regular User
 
Tharaka Deshan's Avatar
 
Join Date: Jan 2010
Location: Galle, Sri Lanka
Posts: 15
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
Old 03-28-2010, 05:25 PM   #2 (permalink)
Member
 
novintabligh's Avatar
 
Join Date: Mar 2010
Posts: 106
Send a message via Yahoo to novintabligh
Default Re: PHP script to Upload file

good info thanks.
novintabligh is offline   Reply With Quote
Old 04-02-2010, 03:16 AM   #3 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 4
Default Re: PHP script to Upload file

Thanks for the script regarding upload the files in PHP.

6ave coupon code
joeluice is offline   Reply With Quote
Old 04-11-2010, 10:55 AM   #4 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 48
Default Re: PHP script to Upload file

good ,thanks
qust is offline   Reply With Quote
Old 04-12-2010, 12:03 AM   #5 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 1
Default Re: PHP script to Upload file

Script will work but not validating the file. You should use some validation in this script as its unsecure.
Tacroy is offline   Reply With Quote
Old 04-13-2010, 04:55 AM   #6 (permalink)
Junior Member
 
AmbrellCooder's Avatar
 
Join Date: Feb 2010
Location: India
Posts: 28
Default PHP script to Upload file

Thanks for your nice and useful script.
AmbrellCooder is offline   Reply With Quote
Old 04-22-2010, 03:21 PM   #7 (permalink)
Junior Member
 
Join Date: Nov 2009
Posts: 17
Default Re: PHP script to Upload file

Small and useful .. thanks
webTHEmaster is offline   Reply With Quote
Old 05-18-2010, 05:21 PM   #8 (permalink)
Member
 
Join Date: Apr 2010
Posts: 132
Default Re: PHP script to Upload file

Very nice useful tutorial you got there. I saw a similar one but with more elaborate settings on my host's forum at myhosting.com Forums

Maybe you should add a small template? Options to add more upload slots?
chrisphs09 is offline   Reply With Quote
Old 05-18-2010, 07:07 PM   #9 (permalink)
Junior Member
 
Join Date: May 2010
Posts: 13
Default Re: PHP script to Upload file

looks simple & effective but adding some restrictions is a lot better for secure and happy surfing for us all....
paparts is offline   Reply With Quote
Old 05-19-2010, 03:01 PM   #10 (permalink)
Member
 
Join Date: Apr 2010
Posts: 132
Default Re: PHP script to Upload file

I am also kind of weary on this tutorial now that I have tried it. It is really unclear where you should replace text with where your directories go.

The tutorials at Beginners - myhosting.com Forums are definitely more elaborate and more secure in my opinion.
chrisphs09 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



» 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 02:46 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting