简体   繁体   中英

move_uploaded_file php function is not working

I know very well that similar questions are answered many times in this site. I google and search many forum bt I can't solve the problem.

move_uploaded_file function is not working, this function cannot upload the file due to appropriate path.

Here is my code

$targetPath = "/home/abc/public_html/uploads/";

        let my website is abc.com

        move_uploaded_file($_FILES['Filedata']['tmp_name'],$targetPath.$_FILES['Filedata']['name']);
  • I have to upload file in /public_html/uploads/downloads
  • move_uploaded_file function is in /public_html/assets/uploadify
  • input form is in /public_html/application/modules/downloads/views/admin location

NOTE: This code is working fine in my localhost

can anybody suggest for path

Plz dnt mark dublicate

Assuming that your upload file is in the public_html directory, change the $targetPath to /uploads/ and change

move_uploaded_file($_FILES['Filedata']['tmp_name'],"$targetPath".$_FILES['Filedata']['name']);

This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM