php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61538 When I uploaded a PDF file.
Submitted: 2012-03-28 06:42 UTC Modified: 2012-03-28 07:09 UTC
From: fozzmarc at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.4.0 OS: Xubuntu 11.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fozzmarc at gmail dot com
New email:
PHP Version: OS:

 

 [2012-03-28 06:42 UTC] fozzmarc at gmail dot com
Description:
------------
When I upload a PDF file(Version of the PDF file is 1.6) to server, then the 
HTTP File Upload variables($_FILES) can't explained that. odd..

Follow code is show the result of var_dump($_FILES):

  array (size=1)
  'upfile' => 
    array (size=5)
      'name' => string 'music.pdf' (length=9)
      'type' => string '' (length=0)
      'tmp_name' => string '' (length=0)
      'error' => int 1
      'size' => int 0

When I use linux command "file" to determine the type of the pdf file:

user@Xubuntu:Documents$ file music.pdf
music.pdf: PDF document, version 1.6


uh.. and when I upload pdf file the version <1.6 (or other type zip or jpg), PHP 
work fine...

Test script:
---------------
<?php
if (!empty($_FILES['file'])) {
	var_dump($_FILES);
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Test</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form action="#" method="POST" enctype="multipart/form-data" >
<input type="file" name="file"/>
<input type="submit" value="Upload"/>
</form>
</body>
</html>

Expected result:
----------------
array (size=1)
  'file' => 
    array (size=5)
      'name' => string 'music.pdf' (length=9)
      'type' => string 'application/pdf' (length=15)
      'tmp_name' => string '/tmp/phpyYtS6E' (length=14)
      'error' => int 0
      'size' => int 75749

Actual result:
--------------
array (size=1)
  'upfile' => 
    array (size=5)
      'name' => string 'music.pdf' (length=9)
      'type' => string '' (length=0)
      'tmp_name' => string '' (length=0)
      'error' => int 1
      'size' => int 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-28 06:56 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2012-03-28 06:56 UTC] aharvey@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The size of your file has exceeded the upload_max_filesize configuration variable, 
as the error value of "1" indicates. Documentation: 
http://au2.php.net/manual/en/features.file-upload.errors.php
 [2012-03-28 07:09 UTC] fozzmarc at gmail dot com
oh, I'm soooooooooooooo sorry.
I didn't see clearly.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 14:01:32 2025 UTC