Hi all
Further to my earlier posting and the advice recieved I have now modified my
code but it still doesn't work. I am trying to upload a file from my local PC to
my remote server by using a form.
This is the form
<html>
<head></head>
<body>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="150000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
</body>
</html>
and this is the upload.php script to handle the uploaded file
<?php
$uploaddir = 'images/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Error uploading file.\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
I get a success message like this
File is valid, and was successfully uploaded.
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => 1.jpg
[type] => image/pjpeg
[tmp_name] => C:\WINDOWS\TEMP\php8528.tmp
[error] => 0
[size] => 4435
)
)
But when I look in the directory on my server the file is not there. Now pulling
my hair out as this was supposed to be a simple exercise and I've spent 3 days
on it!! Please help me out here!
Regards
Dynamo