Php uploads PDF files, some special characters are lost

Source: Internet
Author: User
Php uploads PDF files. some special characters are lost. php uploads PDF files. uploaded to the server. some special characters in the PDF file are not displayed. After compressing the PDF file into a zip file, the system prompts that the compressed file is damaged.
Answers from experts


Reply to discussion (solution)

Php does not destroy the file content when uploading files. This can be seen from the original display of the uploaded image.
Of course, if you have processed him again, it will be another matter.

In terms of appearance, your font files are not inline and are not OS fonts used.

If you upload files directly using the control that comes with your browser, the file will not be damaged.
If you use a third-party plug-in, you need to study it, or try another third-party plug-in.
If you want to upload a file stream, you must pack and compile the package before and after decompression. you can use functions such as serialize () to compile and store the package, and then unserialize the download, to ensure that the file stream will not be lost or deteriorated during transmission.

This PDF file was sent to me by someone else. it's okay to open it directly. This problem also occurs when I perform test upload on the local machine.

If there is no secret, you can put it on a cloud disk.

If there is no secret, you can put it on a cloud disk.


It's hard to figure out why some characters are lost after the upload.




Var_dump ($ _ FILES );
If ($ _ FILES ["file"] ["error"]> 0)
{
Echo "Error:". $ _ FILES ["file"] ["error"]."
";
}
Else
{
Echo "Upload:". $ _ FILES ["file"] ["name"]."
";
Echo "Type:". $ _ FILES ["file"] ["type"]."
";
Echo "Size:". ($ _ FILES ["file"] ["size"]/1024). "Kb
";
Echo "Stored in:". $ _ FILES ["file"] ["tmp_name"];
Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"], "D:/Apache2.2/htdocs/javasjs/web/files /". $ _ FILES ["file"] ["name"]);
}
?>


Pdf address: http://pan.baidu.com/s/1i3qWHeP has time to test thank you

Use your programs and files to test successfully.
No problems found

Use your programs and files to test successfully.
No problems found


Does the uploaded pdf contain no characters! You can see


If the content is intact, it will not be pasted.


If the content is intact, it will not be pasted.


I just uploaded an lnmp environment in linux again. it may be due to environment configuration problems! I want to find another reason! Thank you.

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.