mysql - the path for the folder in my server (PHP) -
i have problem in php code.
have form let user upload files server, did not know how write correct path folder in server![enter image description here][1] want files store in, how path specific file download later.
the path in server : /public_html/upload_files
but keeps tell me :
warning: move_uploaded_file(upload_files/project_guidelines.pdf): failed open stream: no such file or directory in d:\sites\dwts.com\public_html\website\creat.php on line 50 warning: move_uploaded_file(): unable move 'c:\windows\temp\php14ac.tmp' 'upload_files/project_guidelines.pdf' in d:\sites\dwts.com\public_html\website\creat.php on line 50 error uploading file
code:
$len = count($_files['attachment']['name']); for($i = 0; $i < $len; $i++) { $uploaddir = 'upload_files/'; $filename = $_files['attachment']['name'][$i]; $tmpname = $_files['attachment']['tmp_name'][$i]; $filesize = $_files['attachment']['size'][$i]; $filetype = $_files['attachment']['type'][$i]; $filepath = $uploaddir . basename($_files['attachment']['name'][$i]); $result = move_uploaded_file($tmpname,$filepath); if (!$result) { echo "error uploading file"; exit; }
thanx ðŸ˜
$uploaddir = 'upload_files/';
where drive? windows, needs drive:
$uploaddir = 'c:/upload_files/';
you can't give partial location second argument of move_uploaded_file
...it needs full path.
Comments
Post a Comment