Jump to content

php file upload errors


pouncer

Recommended Posts

[code=php:0]
<?php
$file_dir = "c:/domains/interzurf.nl/wwwroot/socialnetworking";

foreach($_FILES as $file_name => $file_array) {
echo "path: " . $file_array['tmp_name'] . "<br>\n";
echo "name: " . $file_array['name'] . "<br>\n";
echo "size: " . $file_array['type'] . "<br>\n";
echo "type: " . $file_array['size'] . "<br>\n";

if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'], "$file_dir/$file_array[name]") or die("Couldnt copy");

echo "file was moved<br><br>";
}
}
?>
[/code]

And this is the html...

[code]
<html>
<head>
<title>A simple file upload form</title>
</head>
<body>
<form action="profile_image_upload.php" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
<p><strong>File to upload:</strong> <input type="file" name="fileupload"></p>
<p><input type="submit" value="upload!"></p>
</form>
</body>
</html>
[/code]

Problem is when i upload i get this:

path: C:\PHP4\uploadtemp\php73AE.tmp
name: image.JPG
size: image/pjpeg
type: 129022

Warning: move_uploaded_file(c:/domains/interzurf.nl/wwwroot/socialnetworking/image.JPG) [function.move-uploaded-file]: failed to open stream: No such file or directory in c:\domains\interzurf.nl\wwwroot\socialnetwork\profile_image_upload.php on line 11

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP4\uploadtemp\php73AE.tmp' to 'c:/domains/interzurf.nl/wwwroot/socialnetworking/image.JPG' in c:\domains\interzurf.nl\wwwroot\socialnetwork\profile_image_upload.php on line 11
Couldnt copy

Hope someone can help me out please, thanks
edit: line 11 is the 'move_uploaded_file' line
Link to comment
https://forums.phpfreaks.com/topic/35292-php-file-upload-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.