...

View Full Version : error with upload php file...



mia_tech
08-02-2008, 01:14 AM
I have a very simple php file that uploads a file to the server, but I'm getting errors, the upload dir on the server has the right permissions.......this is windows server running IIS 6.. here's the code


<html>
<body>
<h3>File upload results.</h3>
<?php
//where files are goint to be uploaded
$file_dir = "C:\Inetpub\wwwroot\upload";

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";

if (is_uploaded_file($file_array['tmp_name'])){
move_uploaded_file($file_array['tmp_name'],
"$file_fir/$file_array[name]") or die ("couldn't copy");
print "file was moved!<br><br>";
}
}
?>
</body>
</html>


if some one could give me a hand as to why the file it's not been uploaded

thanks

www.pctechtips.org

mia_tech
08-02-2008, 01:23 AM
ok guys I found it reading my own code....the error was in this line


"$file_fir/$file_array[name]") or die ("couldn't copy");

I misspelled the variable $file_dir, anyway the editor I'm using is Notepad++, which is open source, and it won't correct if you misspelled something... does anyone know of a decent editor that does some kind of error checking


thanks

www.pctechtips.org



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum