Why attachments cannot be uploaded

Source: Internet
Author: User
Tags php file upload

Why attachments cannot be uploaded
A. The server hard disk has no space
B. Whether to set attribute 777 in The attachement directory and win host attribute everyone
C. "Windows integrated authentication" has been set in IIS ".
D. Delete the folder under the attachments directory and recreate the folder with the same name, and grant the corresponding permissions.
In E. php. ini
Replace; upload_tmp_dir = The annotator of the row, that is, remove the Semicolon ";" to make the row play a role in the PHP. ini document. Upload_tmp_dir is a temporary path used to define the storage of uploaded files. Here you can modify and define an absolute path for it. The directory set here must have read and write permissions.
F. in PHP. ini, set the upload_max_filesize parameter to 2 MB, so that large files can be uploaded. After modification, restart IIS/Apache/Zeus.
G. This problem also occurs when the remote attachment is accidentally enabled or the attachment settings are not complete in the background.
H. In the background, the basic settings for attachments are set to save attachments in other ways. Some servers are not saved in the same directory. Some servers have restricted the directory attributes and cannot upload attachments. (a large proportion of virtual space appears)

;;;;;;;;;;;;;;;;

; File Uploads;

;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.

File_uploads = on

; Temporary directory for HTTP uploaded files (will use system default if not

; Specified ).

Upload_tmp_dir = C:/PHP/uploadtemp

; Maximum allowed size for uploaded files.

Upload_max_filesize = 10 m

Why didn't I put the temporary files I uploaded into C:/PHP/uploadtemp? I can test it locally, but it won't work on other computers. My IIS is assigned permissions. Why does one user have a website? Thank you.

PHP large file upload Problems

Parameters Involved in file upload in PHP:

Several parameter adjustments:

0: temporary directory for storing files during file upload. It must be a directory that can be written by the PHP process owner. If this parameter is not specified, PHP uses the default value.

In the php. ini file, upload_tmp_dir is used to describe the temporary directory of the files uploaded by PHP.

To upload a file, make sure that the server does not have the permission to close the temporary file and write the folder.

1: max_execution_time

The max_execution_time variable sets PHP to wait for the script to be executed before force termination.
Time, in seconds. When the script enters an infinite loop state
This variable is very useful. However, when there is a legal activity that takes a long time to complete (such as uploading large files), this function will also cause operation failure. In this case, you must consider increasing the value of this variable.
To prevent PHP from closing the script when the script is executing some important processes.

Max_execution_time = 90

2: file_uploads = on

3: upload_max_filesize = 2 m

4: post_max_size

A variable related to form submission is post_max_size, which will be controlled in the POST method
Maximum data size that PHP can receive in Form submission. It seems unlikely that the default 8
MB is larger. Instead, it should be appropriately reduced to a more practical value. If you want to use the PHP file upload function, you need to change this value to a value greater than upload_max_filesize.
Large.

Post_max_size = 8 m

5: max_input_time

This variable can be used to limit the time when data is received through post, get, and put in seconds. If the application's running environment is on a low-speed link, you need to add this value to adapt to the more time required to receive data.

Max_input_time = 90

6: memory_limit

Memory_limit = 8 m

To avoid using a large amount of available memory by running scripts, PHP allows you to define the memory usage limit. Use the memory_limit variable to specify the maximum memory capacity that a single script program can use.

The value of the variable memory_limit should be greater than the value of post_max_size.

How to Implement PHP large file upload:

A simple configuration example can be found below:

1: Open PHP. ini, first find

File_uploads = on; whether to allow file upload over HTTP. On is enabled by default.

Upload_tmp_dir; upload the file to the place where the temporary file is stored on the server. If it is not specified, the default Temporary Folder will be used.

Upload_max_filesize = 8 m; wangwen business, that is, the maximum file size allowed to be uploaded. The default value is 2 MB.

Post_max_size = 8 m; the maximum value that can be received by posting a form to PhP, including all values in the form. The default value is 8 Mb.

Generally, after the preceding four parameters are set, uploading the file <= 8 m is not a problem, but the network is normal.

However, if you want to upload a large file larger than 8 Mb, you can only set the above four items. Unless your network has a high upload speed of 100 Mbit/s, you have to pay attention to the following parameters.

Max_execution_time = 600; maximum time (in seconds) for running each PHP page. The default value is 30 seconds.

Max_input_time = 600; maximum time required for receiving data on each PHP page. The default value is 60 seconds.

Memory_limit = 8 m; maximum memory consumed by each PHP page. The default value is 8 m.

After modifying the preceding parameters, you can upload a large volume of files as permitted by the network.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.