uploadfile function not working
Posted: Mon May 15, 2006 7:04 am
Hi, having trouble with a file upload function i've created. This code works:
I create a function that replicates this code:
and use include at top of page to include file where function is and call function - i get these errors:
what am i doing wrong here? Also using the $_FILE['flashfile']['tmp_name'] type format doesn't seem to work for me. For example $flashfile_name works fine but $_FILE['flashfile']['name'] does not. Any help much appreciated
Code: Select all
$uploaddir = URL_SSFLASH;
$uploadfile = $uploaddir . $flashfile_name;
if (move_uploaded_file($flashfile, $uploadfile)) {
$msg="File is valid, and was successfully uploaded.\n";
} else {
$msg="Possible file upload attack!\n";
}
echo $msg;Code: Select all
function uploadfiles($fileaddress, $filedest) {
$filet=$filedest.$fileaddress_name;//set new destination
if(move_uploaded_file($fileaddress, $filet)){
return "File uploaded successfully";
} else {
return "Error uploading file";
}
};Code: Select all
Warning: move_uploaded_file(../swfsss/): failed to open stream: Is a directory in /home/screensa/public_html/adm/sys_func.php on line 14
Warning: move_uploaded_file(): Unable to move '/tmp/phpdDDcwK' to '../swfsss/' in /home/screensa/public_html/adm/sys_func.php on line 14
Error uploading file