oh... i am up against the wall and sliding fast....
all i am trying to do is upload a file to a directory on the webserver. (i'd love to email to me also but thats asking to much)
here is my code so far:
<html>
<head>
<title>Listing 9.14 A file upload script</title>
</head>
<body>
<h1>File Upload Results</h1>
<?php
$file_dir = "/form";
foreach($_FILES as $file_name => $file_array) {
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "size: ".$file_array['size']."<br>\n";
print "file dir: ".$file_dir."<br>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'],
"$file_dir/$file_array[name]"
or die ("Couldn't copy"
;
print "file was moved!<br><br>";
}
}
?>
</html>
************************************
needless to say, it doesnt work. i get an error:
path: /tmp/php00010213aa
name: yourship.jpg
type: image/pjpeg
size: 4224
file dir: /form
Warning: move_uploaded_file(/form/yourship.jpg): failed to open stream: No such file or directory in /local/vips/home0/nathan/skylineprints.com/listing9.14.php on line 19
Warning: move_uploaded_file(): Unable to move '/tmp/php00010213aa' to '/form/yourship.jpg' in /local/vips/home0/nathan/skylineprints.com/listing9.14.php on line 19
Couldn't copy
i am very new to PHP but need someone's help. I am very lost.... :-(
Have A Great Day!!!,![[bigglasses] [bigglasses] [bigglasses]](/data/assets/smilies/bigglasses.gif)
Nathan
Software Testing Lead
all i am trying to do is upload a file to a directory on the webserver. (i'd love to email to me also but thats asking to much)
here is my code so far:
<html>
<head>
<title>Listing 9.14 A file upload script</title>
</head>
<body>
<h1>File Upload Results</h1>
<?php
$file_dir = "/form";
foreach($_FILES as $file_name => $file_array) {
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "size: ".$file_array['size']."<br>\n";
print "file dir: ".$file_dir."<br>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'],
"$file_dir/$file_array[name]"
print "file was moved!<br><br>";
}
}
?>
</html>
************************************
needless to say, it doesnt work. i get an error:
path: /tmp/php00010213aa
name: yourship.jpg
type: image/pjpeg
size: 4224
file dir: /form
Warning: move_uploaded_file(/form/yourship.jpg): failed to open stream: No such file or directory in /local/vips/home0/nathan/skylineprints.com/listing9.14.php on line 19
Warning: move_uploaded_file(): Unable to move '/tmp/php00010213aa' to '/form/yourship.jpg' in /local/vips/home0/nathan/skylineprints.com/listing9.14.php on line 19
Couldn't copy
i am very new to PHP but need someone's help. I am very lost.... :-(
Have A Great Day!!!,
![[bigglasses] [bigglasses] [bigglasses]](/data/assets/smilies/bigglasses.gif)
Nathan
Software Testing Lead