php error message

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

holisticsam
New php-forum User
New php-forum User
Posts: 4
Joined: Wed Apr 24, 2013 10:55 am

php error message

Postby holisticsam » Fri May 02, 2014 11:28 am

I got the below error mesage when trying to run this simple file uploading php script.

I'm pretty sure my directory is -
/home/wholisti/public_html/uniquenutrition/distributorsignupform/distributorsignupform or
/public_html/uniquenutrition/distributorsignupform

Do I need to change my directory permission to allow public write?

Error message
*************
Warning: copy(sm.dat) [function.copy]: failed to open stream: No such file or directory in /home/wholisti/public_html/uniquenutrition/distributorsignupform/upload_file.php on line 7
Could not copy file!

*****************************
<?php
if( $_FILES['file']['name'] != "" )
{

//echo "test";

copy( $_FILES['file']['name'], "/home/wholisti/public_html/uniquenutrition/distributorsignupform/distributorsignupform" ) or
die( "Could not copy file!");


// copy( $_FILES['file']['name'], "/public_html/uniquenutrition/distributorsignupform" ) or
// die( "Could not copy file!");

// copy( $_FILES['file']['name'], "/var/www/html" ) or
// die( "Could not copy file!");


}
else
{
die("No file specified!");
}
?>


<html>
<head>
<title>Uploading Complete</title>
</head>
<body>
<h2>Uploaded File Info:</h2>
<ul>
<li>Sent file: <?php echo $_FILES['file']['name']; ?>
<li>File size: <?php echo $_FILES['file']['size']; ?> bytes
<li>File type: <?php echo $_FILES['file']['type']; ?>
</ul>
</body>
</html>

*******************
HTML form calling php file
*******************
<html>
<head>
<title>File Uploading Form</title>
</head>
<body>
<h3>File Upload:</h3>
Select a file to upload: <br />
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron