Help with uploading files
Posted: Tue Feb 03, 2009 8:01 pm
Hi,
Im trying to upload images to a server but i cant get the php code to work. I have pretty much copied the code word for word from a tutorial - can any of you tel me why this is?
---------------------------------------------------------------------------------------------------
<?php
if (getimagesize($_FILES['file']['tmp_name']) && $_FILES['file']['error'] == UPLOAD_ERR_OK)
{
$currentdir=getcwd();
move_uploaded_file($_FILES['file']['tmp_name'],
$currentdir . $_FILES['file']['name']);
echo ("<h1>Well Done</h1>");
}
echo ("<form action='{$_SERVER['PHP_SELF']}' method='post' enctype='multipart/form-data'>
<label for='file'>Image:</label>
<input type='file' name='file' id='file' class = 'contactfield'/>
<input type='submit' class = 'submit' value='Create This Entry!' />
</form>
?>
Im trying to upload images to a server but i cant get the php code to work. I have pretty much copied the code word for word from a tutorial - can any of you tel me why this is?
---------------------------------------------------------------------------------------------------
<?php
if (getimagesize($_FILES['file']['tmp_name']) && $_FILES['file']['error'] == UPLOAD_ERR_OK)
{
$currentdir=getcwd();
move_uploaded_file($_FILES['file']['tmp_name'],
$currentdir . $_FILES['file']['name']);
echo ("<h1>Well Done</h1>");
}
echo ("<form action='{$_SERVER['PHP_SELF']}' method='post' enctype='multipart/form-data'>
<label for='file'>Image:</label>
<input type='file' name='file' id='file' class = 'contactfield'/>
<input type='submit' class = 'submit' value='Create This Entry!' />
</form>
?>