Open Bug 61855 Opened 24 years ago Updated 2 years ago

Using byte-scanner to determine the mime-type of uploaded file if it's not known[form sub]

Categories

(Core :: DOM: Core & HTML, enhancement, P4)

enhancement

Tracking

()

Future

People

(Reporter: bugzilla, Unassigned)

References

Details

This bug is a related bug from bug 59411: If you upload a file that is of filetype "unknown", the file is currently set to "application/octet-stream". It could be nice if some kind of byte-scanning were used to determine the mime-type if it's not known. IE does this.
eric I will let you have this for now
Assignee: rods → pollmann
Target Milestone: --- → Future
RFE cleanup. RFE is already indicated by the Severity field...Sorry for the spam!
Summary: RFE: using byte-scanner to determine the mime-type of uploaded file if it's not known → Using byte-scanner to determine the mime-type of uploaded file if it's not known
Bulk reassigning form bugs to Alex
Assignee: pollmann → alexsavulov
Summary: Using byte-scanner to determine the mime-type of uploaded file if it's not known → Using byte-scanner to determine the mime-type of uploaded file if it's not known[form sub]
If we end up using nsIRequest, then we could use existing functionality in ./netwerk/streamconv/converters/nsUnknownDecoder.cpp. Setting dependent on bug 114106 in case we go that route.
Depends on: 114106
Priority: P3 → P4
any news on that? On Un*x platforms the most files don't have extensions. So Mozilla does always upload application/octet-stream. There are many webinterfaces which don't allow to change the mime-type after upload for the documents.
See ongoing discussion in netscape.public.mozilla.netlib
Short story: this is a question of how we should expose the functionality. Several options: 1) Have a method that takes a buffer and returns a type (essentially expose nsUnknownDecoder::DetermineContentType). Pros: simple. Cons: needs a buffer. 2) Have a method that takes a rewindable stream and returns a type. Pros: also pretty simple. Cons: needs a rewindble stream. 3) Have a method that takes a stream, returns a stream to read from (which therefore has to wrap the other stream), and allows the type to be read off from somewhere (or just returns it). Pros: don't need anything special. cons: rather complicated. In all methods, the nsIFile should get passed in in addition to the stream, so that nsUnknownDecoder can just apply its usual algorithm. biesi, darin, thoughts?
Assignee: alexsavulov → nobody
QA Contact: vladimire → form-submission
Component: HTML: Form Submission → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.