Using PHP move_uploaded_file function permission denied -
i've been stuck on code days hitting error when upload file server. windows server running on apache
tried various solutions still receiving error. tried changing full permissions on server.
i changed default php upload tmp file inside application yet still having error.
warning: move_uploaded_file(c:\my_workspace\ojs2002) [function.move-uploaded-file]: failed open stream: permission denied in c:\my_workspace\ojs\admin\include\fileupload.php on line 78
warning: move_uploaded_file() [function.move-uploaded-file]: unable move 'c:\my_workspace\ojs\tmp\phpcb78.tmp' 'c:\my_workspace\ojs2002' in c:\my_workspace\ojs\admin\include\fileupload.php on line 78
// copy file, making destination directory if necessary $filedir = 'c:/my_workspace/ojs2002/'.basename($_files['articlefile']['name']); chmod($_files["articlefile"]["tmp_name"], 0777); chmod($filedir, 0777 ); move_uploaded_file($_files["articlefile"]["tmp_name"],$filedir);
the code work fine on linux servers not on windows.
any appreciated. thank you.
chmod
won't work on windows, uses different type of permission system. make sure user apache runs has full write access folder you're trying move files (right click , click on sharing or permissions depending on version of windows)
Comments
Post a Comment