Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!
Site Owners Forums - Webmaster ForumsCalendarContact Us

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > PHP / mySQL


Reply
 
Thread Tools Rate Thread Display Modes
Old 01-19-2006, 06:32 AM   #1
dignat
Registered User
 
Join Date: Jan 2006
Posts: 1
upload file with php script

Hello
I need some help. I am trying to upload a file .
First i made a HTML form to attache a file
then I made a php script which must upload this file to a temp folder than to copy in amother. but it is not happening. I will write down the php script.Also I try to give permition for writhing in the temp and the last folder, but it wasn't happen again. Please help!
<?php
if( $_FILES["file"]["name"] !="" )
{ copy ( $_FILES["file"]["tmp_name"],

"/Program Files/Apache Group/Apache2/htdocs/" .
$_FILES['file']['name'])
or die ("File can not be copied") ;}
else
{ die ("File is not choosed") ;}

?>

<html>
<head>
<title>File is attached succesfull</title>
</head>
<body>
<b><center>File is attached succesful</center></b><br><br>
Name:<?php echo $_FILES["file"]["name"] ; ?><br>
Size:<?php echo $_FILES["file"]["size"] ; ?> byts <br>
Type:<?php echo $_FILES["file"]["type"] ; ?><br>
<a href="<?php echo ($_FILES['file']['name']) ;
?>">Click here, to see the file</a>
</body>
</html>
dignat is offline   Reply With Quote

Old 02-05-2006, 01:15 PM   #2
campbeld
Registered User
 
Join Date: Feb 2006
Posts: 3
a few things must change

There's so many things that need changing with your code I can't explain it all here. All I can say is go to http://www.php.net/ and look at the file uploading instructions.
campbeld is offline   Reply With Quote
Old 05-06-2006, 03:55 AM   #3
corax
Registered User
 
Join Date: May 2006
Posts: 2
1) check the enctype in your FORM tag, it must be like

<form action="" method="post" enctype="multipart/form-data">

2) use the move_uploaded_file() function instead copy()
__________________
PHP Photo Album - add photo gallery to your website in 5 minutes
corax is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Misconceptions about PHP joeboe General Discussion 4 08-08-2006 05:02 PM
2 profitable sites for sale alexdio Trading Post 0 12-21-2004 08:08 AM
The robots.txt file: Article Part 2- Optimization Pannu Search Engine Optimization 0 05-24-2004 09:00 AM
The robots.txt file: Article Part 1 - Introduction Pannu Search Engine Optimization 0 05-24-2004 08:54 AM
Updating a html file with php... i'm stuck, please help mojo PHP / mySQL 2 09-16-2002 05:42 AM


All times are GMT -7. The time now is 08:24 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Kindly hosted by OH Telecom servers (get one!)
Site Delivered By Liberty Of Mind - #1 Adult & Mainstream Solutions Provider

Virtual Dedicated Server     Advertise