I am having a problem with my function moving a file, here is my code:
function uploadFile($username, $folder_name){
GLOBAL $img, $img_name, $img_description;
echo $username ."<BR>". $img ."<BR>". $img_name ."<BR>". $img_description;
$image_id = time();
// "../tmp/$username/$folder_name/$img_name"
$destination = "../tmp/$img_name";
if (!is_uploaded_file($img)) {
echo( "<SPAN CLASS=\"black_normal\"><B><BR> Sorry I cannot find the file you are trying to upload</SPAN><BR><P>" );
return FALSE;
} else {
echo( "<SPAN CLASS=\"black_normal\"><BR> Copying <B>" . $img_name . "</B> from <B>" . $img . "</b> to <B>../tmp/</B></SPAN><BR>" );
move_uploaded_file($img,$destination) or die("<SPAN CLASS=\"black_normal\"><BR> <B>Sorry, file copy failed. Please try again.</B></SPAN><BR>");
};
};
When I put this code on a separate page without anything else but this function and an html page with and input file it works.....but as soon as I put it in my page with other functions it prints out weird image attributes.....
view here for code with no frills:
www.magform.com/upload.html
view same code here with frills and not working...but notice the missing variables:
www.magform.com/upload.php (just click on add to this folder)
Chad....