I have an uploading script but i don't know what is the problem it always gives "Error". Here is the script

<?php
include ("include/session.php");
$username = $session->username;

if ($_REQUEST[completed] == 1) {
$newname = $username . ".gif";
move_uploaded_file($_FILE['mailfile']['tmp_name'], "./$newname") or die("Error");
}
?>
<?php if ($_REQUEST[completed] != 1) { ?><b>Please upload an image</b>
<br />

<form enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1500000"> <input type="hidden" name="completed" value="1"> Choose file to send: <input type="file" name="mailfile"><br /><input type="submit" value="Upload">
</form>

<?php

} else {

?>

<b>File Uploaded</b>

<?php

}

?>

Please help me........
Thanks

Check if the webserver has permission to write to your tmp- and your destination-folder. This is the only thing I can think of right now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.