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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 04:01:32 2024 UTC