Closed Bug 377615 Opened 17 years ago Closed 17 years ago

More than 2 non-ascii characters in a row in the filename cause problem on upload.

Categories

(Firefox :: File Handling, defect)

2.0 Branch
PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 66041

People

(Reporter: fjutt, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070322 Firefox/2.0.0.3
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

An uploaded file is empty when uploading a file with multiple non-ascii characters in a row in it. One example of a failing file is åäö.rtf 

The upload works fine if the non-ascii characters are split up by adding some ascii characters to the filename. Throw in an 'a' between the non-ascii characters in the filename above and it will work just fine.

When failing the upload the file type is identified as "application/octet-stream" and not "application/rtf" as it should be. 

Reproducible: Always

Steps to Reproduce:
1. Create 2 web pages:
index.php
================================
<html>
   <form action="upload.php" method="post" enctype="multipart/form-data">
     <input type="file" name="file">
     <input type="submit" value="Submit">
   </form>
</html>
================================

upload.php
================================
<?php
    echo "Orginal: " . $_FILES['file']['name'] . "<p>";
    echo "File " . $_FILES['file']['tmp_name'] . " is: " . filesize($_FILES['file']['tmp_name']) . " bytes<p>";
    echo "Type " . $_FILES['file']['type'] . "<p>";
    echo ( fread( fopen($_FILES['file']['tmp_name'], "rb"), filesize($_FILES['file']['tmp_name'])));
?>
<p>
<a href="index.php">Back</a
================================

2. Create a file with more than 2 trailing non-ascii characters. I used &#229;&#228;&#246;.rtf (åäö.rtf)

3. From the index.php page browse to upload the created file. 

4. Submit the form to view the result.
Actual Results:  
The result indicates that the file size is 0 bytes and that the file type is "application/octet-stream".

=========================
Orginal: åäö.rtf

File /tmp/phpC006hw is: 0 bytes

Type application/octet-stream


Warning: fread() [function.fread]: Length parameter must be greater than 0 in /var/www/localhost/htdocs/gu/upload.php on line 10

Back
===============================

Expected Results:  
Just renaming the file to "abc.rtf" instead produce the following expected result when uploading a file. 

===================================
Orginal: abc.rtf

File /tmp/phpKroiX1 is: 31 bytes

Type application/rtf

lsdjkfalskdfj alskdja alskjdf

Back
=================================

This is not .rft specific. The error happens with all file types.
Version: unspecified → 2.0 Branch
The issue can be easily reproduced on Mac OS X with Firefox 1.5 & 2.0 against
different servers.

It reproduces against a PHP application, as well as Java servlets.

Also, on the same Mac OS X client, Safari successfully uploads the files with
non-ascii characters.
Yeah, I can experience that with my OS X trunk builds, and Fx 2.0.0.3.

I think this is a duplicate of bug 66041 - at least some dupes of this point to that bug report.
Mmm, bug 66041 sounds very much the same as this does. This bug is reproducable in the latest hourly build of the trunk though so it is a bit strange that the last comment in 66041 says that the problem can't be reproduced.
The last comment was probably just someone testing it wrong. This is almost certainly a duplicate of bug 66041. Duping there...
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.