Hello guys, My bf had a problem with his code in uploading file.. I include here the codes.. Could anyone please take a look with this code and tell me what is the error. Thank you in advance. His message: $tempname = str_replace(" ","_",$_FILES['uploadedfile']['name']); $destination_file = "uploads/".$tempname; $source_file = $_FILES['uploadedfile']['tmp_name'] ; if(copy($source_file, $destination_file)) { $msg = "Uploaded $source_file to $ftp_server as $destination_file"; $address = $_SESSION['current_user']; $fname = $_SESSION['first_name']; $lname = $_SESSION['last_name']; $filename = $tempname; mail("email@email.com", "File Upload by $fname $lname", "http://www.domain.net/uploads/".$filename, "From: domain.com" ); }else{ $msg = "Upload Failed! Please try or check path of file to be uploaded."; } Code (markup): Thank you
Is the tmp directory properly chmodded? Because if it's not, that would mean no copy, and no file existing in the uploads section .
try to set $destination_file as full path. $destination_file = "/home/account/public_html/uploads/".$tempname; Code (markup): also make sure uploads folder exist and permisions are 777. if doesn't work, add print_r($_FILES['uploadedfile']); Code (markup): and paste the results.
Thank you guys for all the reply... it helps a lot to my boyfriend to figure out the error. Here is what he sed Well... I'm very happy to be a part of this forum, there's a lot of very helpful member member. Thanks again, I hope someday I can also help someone... regarding with PHP code.