Source Rally PHP Community Scripts .. Sign up .. Login
Avoid writing $_FILES['tmp_name']...
LGPL license
Access: Public      Tags: php, upload
Add to favourites       Subscribe comments       Copy code       Bookmark
<?php
/*
Example from:

<?php
if(upload('file','uploadedFiles/theFileName.txt'))
{
    echo 'uploaded!!';
}
?>
<form enctype="multipart/form-data" action="" method="post">
<input type="file" name="file" value=""><br>
<input type="submit" name="submit" value="Upload">
</form>
*/
function upload($mixed,$newPath)
{
    if(!
is_array($mixed))
    {
        
$mixed $_FILES[$mixed];
    }
    if(
move_uploaded_file($mixed['tmp_name'], $newPath))
    {
        return 
true;
    }
    else
    {
        return 
false;
    }
}
?>
Add to favourites       Subscribe comments       Copy code       Bookmark
Sign up to add your own comment here!

Shared by:

regin

Mail user Add to friends
All user contributed content is available under the unless specified otherwise.
Remaining copyrights Regin Gaarsmand 2006-2008
About www.SourceRally.net