php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26326 File upload wont work if spaces not in the right place.
Submitted: 2003-11-19 18:35 UTC Modified: 2003-12-02 13:43 UTC
From: jnixon at postregister dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.3.3 OS: Linux
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: jnixon at postregister dot com
New email:
PHP Version: OS:

 

 [2003-11-19 18:35 UTC] jnixon at postregister dot com
Description:
------------
I'm new at sending out these things, so please be patient.
The problem I am having is with the file upload in apache 2.0.45, and mod_php 4.3.3

Works fine under *nix, it is the Microsoft Windows people I'm having the
problems with.

I bereave it has to do with the spaces in the name.

If the name of the file has no spaces, than the location must not have any spaces.

If the name of the file has a space or more in the name then the location
doesn't matter.

Examples:
Does not work: C:\Documents and Settings\username\Desktop\image.jpg

Works: C:\Documents and Settings\username\Desktop\image name.jpg
Works: C:\image name.jpg
Works: C:\image.jpg
Works: C:\images\imagename.jpg

I'm tying to upload a file using.
<form ENCTYPE="multipart/form-data" action="extra.php" method="POST">
 Upload an image: <input name="userfile" type="file" size="100">
 <input type="submit" value="Send File">
</form>

If the file looks like this:
   C:\Documents and Settings\username\Desktop\image.jpg

I have submited an bug report with apache and they said it was not a problem with apache.

Reproduce code:
---------------
<form ENCTYPE="multipart/form-data" action="extra.php" method="POST">
 Upload an image: <input name="userfile" type="file" size="100">
 <input type="submit" value="Send File">
</form>

Expected result:
----------------
Netscape gives an error of "The document contains no data".
In IE I get the page cannot be displayed error.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-19 18:38 UTC] sniper@php.net
And what exactly do you have in the extra.php script??

 [2003-11-19 19:33 UTC] sniper@php.net
Replace that script with this:

<?php

var_dump($_FILES);

?>

And post the output here (when you upload the problem file to it)

 [2003-11-20 10:06 UTC] jnixon at postregister dot com
I created a simplified version with the code you wanted.
Here are the links, with the source.

http://www.postregister.com/uploadimage/index.php
http://www.postregister.com/uploadimage/index.phps

I got the same results.
 [2003-11-20 19:28 UTC] iliaa@php.net
Works just fine, I've uploaded "a b.html" and it worked perfectly.
 [2003-11-20 19:54 UTC] pollita@php.net
Actually ilia, your test case doesn't match his bug report, but I did a test case which did:

Uploaded a file from  C:\Documents and Settings\pollita\Desktop\test.png

I got exactly what I'd have expected from the form.

array(1) { 
  ["userfile"]=> array(5) { 
    ["name"]=> string(8) "test.png" 
    ["type"]=> string(10) "text/plain" 
    ["tmp_name"]=> string(14) "/tmp/phpuuE33H" 
    ["error"]=> int(0) 
    ["size"]=> int(11) 
  } 
}

 [2003-12-02 10:21 UTC] jnixon at postregister dot com
Try the same test whith an image.
 [2003-12-02 10:23 UTC] jnixon at postregister dot com
I mean a .jpg.
 [2003-12-02 13:43 UTC] pollita@php.net
The extension on the file name would make absolutely no difference (and I invite you to read RFC 1867 to learn why), but to humor you I'll give it a shot.

Uploading: C:\Documents and Settings\pollita\Desktop\php_logo.jpg

<?php print_r($_FILES); ?>

array(1) { 
  ["userfile"]=> array(5) { 
    ["name"]=> string(8) "php_logo.jpg" 
    ["type"]=> string(10) "image/jpeg" 
    ["tmp_name"]=> string(14) "/tmp/phpiwC27H" 
    ["error"]=> int(0) 
    ["size"]=> int(1469) 
  } 
}


Something is wrong with your script, or with an assumption you've made in processing your file.  Please post your question to the generals mailing list for further assistance.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 15:01:33 2024 UTC