File not uploading PHP

后端 未结 9 1550
后悔当初
后悔当初 2020-11-27 23:09

I\'ve attempted to write code to have a file uploaded to a \"media\" folder in PHP. For some reason it continues to not work.

Here\'s the execution code:

<         


        
相关标签:
9条回答
  • 2020-11-27 23:24

    Have you checked that the "web server user" has write permissions to "../media" ?

    0 讨论(0)
  • 2020-11-27 23:26

    In your form tag you want something like this <form enctype="multipart/form-data" action="uploader.php" method="POST"> Make sure enctype is set to multipart/form-data for files. Replace uploader.php with the name of the php file doing the processing. Also make sure your permissions are set so the file can be created in the directory.

    Here's a list of possible problems: http://php.net/manual/en/features.file-upload.php

    0 讨论(0)
  • 2020-11-27 23:36

    Put the encription in form

    <form method="post" action="index.php" enctype="multipart/form-data"></form>
    

    Check in php.ini file max_execution_time heavy images are not uploaded due to execution time..

    0 讨论(0)
  • 2020-11-27 23:37

    make sure media folder has 777 permission and the path ../media/ is correct

    0 讨论(0)
  • 2020-11-27 23:39

    There is a form with encrypt type or an ajax call? Do you check if the file is sended to the upload script (with a print_r($_FILES["file"]). If correct, do you have check if the relative path is correct? You must start from the current script (if file is included you must start from the including script). Sorry if answer seems simply, but the posted code is a little too short to evaluate.

    0 讨论(0)
  • 2020-11-27 23:46

    Make sure that in your form.. you put the enctype.
    eg: <form method="post" enctype="multipart/form-data" action="index.php"></form>;

    To check if files are successfully updated upon submitting the form. use print_r to see results.
    print_r($_FILES);

    0 讨论(0)
提交回复
热议问题