I'm trying to set up a page to do file uploads and I keep running into
problems.
Here's my source code for the page (minimally modified from the source
code in a book):
<html>
<head>
<title>FTP test</title>
</head>
<body>
<form action="uploadmanager.php" enctype="multipart/form-data" method
= "post">
Last Name: <br> <input type="text" name="name" value=""> <br>
Class Notes: <br> <input type="file" name="classnotes" value=""> <br>
<p><input type="submit" name="submit" value="Submit Notes"> </p>
</form>
<?php
define
("FILEREPOSITORY","/web/tgs.gargoyles-fans.org/htdocs/tgs/secure-php/data-entry/");
print "<p>Hmm</p>";
if(is_uploaded_file($_FILES['classnotes']['tmp_name'])) {
$name = $_POST['name'];
$name1 = $_FILES['classnotes']['tmp_name'];
$name2 = $_FILES['classnotes']['name'];
#copy($_FILES['classnotes']['tmp_name'], FILEREPOSITORY .
$_FILES['classnotes']['name']);
print "<P>$name - $name1 - $name2</P>";
$result = move_uploaded_file($_FILES['classnotes']['tmp_name'],
FILEREPOSITORY . $_FILES['classnotes']['name']);
if ($result == 1) print "<p>File was successfully uploaded.</p>";
else print "<p>THere was a problem uploading the file.</p>";
}
?>
</body>
</html>
Whenever I try to use the page, I get the following output:
Hmm
revel-tgs-website.txt - /tmp/php5w8Fyo - revel-tgs-website.txt
Warning:
move_uploaded_file(/web/tgs.gargoyles-fans.org/htdocs/tgs/secure-php/data-entry/revel-tgs-website.txt):
failed to open stream: No such file or directory in
/web/tgs.gargoyles-fans.org/htdocs/secure-php/data-entry/uploadmanager.php
on line 21
Warning: move_uploaded_file(): Unable to move '/tmp/php5w8Fyo' to
'/web/tgs.gargoyles-fans.org/htdocs/tgs/secure-php/data-entry/revel-tgs-website.txt'
in
/web/tgs.gargoyles-fans.org/htdocs/secure-php/data-entry/uploadmanager.php
on line 21
THere was a problem uploading the file.
* * *
Can anybody tell me if this problem is caused by my server not
allowing php file uploads or if there is a problem somewhere in my code?
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/