You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Xav <xx...@wanadoo.fr> on 2006/04/17 17:41:14 UTC

[fileUpload] file content-type

Hello,
I would like to filter the files uploaded, I thought a good way was to 
use the file content type but I realized that it is often 
application/octet-stream regardless to the file uploaded (.doc, .xls, 
.pdf, .txt...).

Am I obliged to filter based on the file extension or there is something 
to tweak to get a more explicit content-type value?

Thanks

Xavier



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Sven Schliesing <sv...@schliesing.de>.
http://sourceforge.net/projects/jmimemagic/ says it's released under the 
GPL/LGPL. Afaik these licenses allow such fork-relases. But I'm not sure.

Anyone?

Mark wrote:
> I would love to do a fork-release and create a commons project.  I
> wonder if the jmimemagic author would be offended though...

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Mark <el...@gmail.com>.
I would love to do a fork-release and create a commons project.  I
wonder if the jmimemagic author would be offended though...


On 4/18/06, Sven Schliesing <sv...@schliesing.de> wrote:
> I'm not a master in licence-things, but couldn't you just do a
> fork-release? Maybe other's would appreciate your work, too.
>
> Mark wrote:
> > I never heard back from the author.  He has a posting on the
> > jmimemagic page at sourceforge that says he is looking for feedback,
> > but has not responded back to any of the feedback posts.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Sven Schliesing <sv...@schliesing.de>.
I'm not a master in licence-things, but couldn't you just do a 
fork-release? Maybe other's would appreciate your work, too.

Mark wrote:
> I never heard back from the author.  He has a posting on the
> jmimemagic page at sourceforge that says he is looking for feedback,
> but has not responded back to any of the feedback posts.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Mark <el...@gmail.com>.
I never heard back from the author.  He has a posting on the
jmimemagic page at sourceforge that says he is looking for feedback,
but has not responded back to any of the feedback posts.

On 4/18/06, Sven Schliesing <sv...@schliesing.de> wrote:
> Sounds interesting. Did you contact the author about your changes? Did
> he respond?
> Maybe you could send me your fixed version?
>
> Thanks!
>
> Sven
>
> Mark wrote:
> > I was thinking the same thing.  If you spend any time with jmimemagic,
> > you find that the API is a little weak.  If you pass in a file, the
> > library goes incredibly slow, because for each file matcher, it
> > creates a new RandomAccessFile object.  Also, there is no support for
> > ByteBuffer.
> >
> > I have fixed these 2 problems in the jmimemagic that I am using....
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Sven Schliesing <sv...@schliesing.de>.
Sounds interesting. Did you contact the author about your changes? Did 
he respond?
Maybe you could send me your fixed version?

Thanks!

Sven

Mark wrote:
> I was thinking the same thing.  If you spend any time with jmimemagic,
> you find that the API is a little weak.  If you pass in a file, the
> library goes incredibly slow, because for each file matcher, it
> creates a new RandomAccessFile object.  Also, there is no support for
> ByteBuffer.
> 
> I have fixed these 2 problems in the jmimemagic that I am using....

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Mark <el...@gmail.com>.
I was thinking the same thing.  If you spend any time with jmimemagic,
you find that the API is a little weak.  If you pass in a file, the
library goes incredibly slow, because for each file matcher, it
creates a new RandomAccessFile object.  Also, there is no support for
ByteBuffer.

I have fixed these 2 problems in the jmimemagic that I am using....

On 4/17/06, Markus Härnvi <ja...@harnvi.net> wrote:
> Mark wrote:
> > I like jmimemagic as well.  Does anyone know if the project is still
> > being maintained?  I have posted a message on the jmimemagic forum and
> > never got a response.  There are a couple things that need to be done
> > I think to make jmimemagic better.
> >
>
> We started a similar project a while back. The idea was to use the BSD
> file(1) database as it is from Java.
>
> It's be better to use a simpler format as jmimemagic has done. The Unix
> magic file is not that nice.
>
> If the author can be convinced to change the license to APL I think it
> is a really good candidate for commons-something.
>
>     /Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Markus Härnvi <ja...@harnvi.net>.
Mark wrote:
> I like jmimemagic as well.  Does anyone know if the project is still
> being maintained?  I have posted a message on the jmimemagic forum and
> never got a response.  There are a couple things that need to be done
> I think to make jmimemagic better.
>   

We started a similar project a while back. The idea was to use the BSD 
file(1) database as it is from Java.

It's be better to use a simpler format as jmimemagic has done. The Unix 
magic file is not that nice.

If the author can be convinced to change the license to APL I think it 
is a really good candidate for commons-something.

    /Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Mark <el...@gmail.com>.
I like jmimemagic as well.  Does anyone know if the project is still
being maintained?  I have posted a message on the jmimemagic forum and
never got a response.  There are a couple things that need to be done
I think to make jmimemagic better.


On 4/17/06, Xav <xx...@wanadoo.fr> wrote:
> Thank you, I think I am going to go that route!
>
> Sven Schliesing wrote:
> > I use jmimemagic (http://sourceforge.net/projects/jmimemagic/) for
> > that. Works nice.
> >
> > Mark wrote:
> >> I would suggest using a library that would check the file type of the
> >> uploaded file.  This will give you a better idea of what the file is.
> >> It is the job of the browser to fill in this data, and based on the
> >> browser, you can get differing values on the server side.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------------------------
> >
> > Wanadoo vous informe que cet  e-mail a ete controle par l'anti-virus
> > mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
> >
> >
> >
> >
>
> --
> A person won't remember you by what you said,
>  but by how you made them feel.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Xav <xx...@wanadoo.fr>.
Thank you, I think I am going to go that route!

Sven Schliesing wrote:
> I use jmimemagic (http://sourceforge.net/projects/jmimemagic/) for 
> that. Works nice.
>
> Mark wrote:
>> I would suggest using a library that would check the file type of the
>> uploaded file.  This will give you a better idea of what the file is. 
>> It is the job of the browser to fill in this data, and based on the
>> browser, you can get differing values on the server side.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> --------------------------------------------------------------------------------------- 
>
> Wanadoo vous informe que cet  e-mail a ete controle par l'anti-virus 
> mail. Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>

-- 
A person won't remember you by what you said,
 but by how you made them feel.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Sven Schliesing <sv...@schliesing.de>.
I use jmimemagic (http://sourceforge.net/projects/jmimemagic/) for that. 
Works nice.

Mark wrote:
> I would suggest using a library that would check the file type of the
> uploaded file.  This will give you a better idea of what the file is. 
> It is the job of the browser to fill in this data, and based on the
> browser, you can get differing values on the server side.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Mark <el...@gmail.com>.
I would suggest using a library that would check the file type of the
uploaded file.  This will give you a better idea of what the file is. 
It is the job of the browser to fill in this data, and based on the
browser, you can get differing values on the server side.


On 4/17/06, Xav <xx...@wanadoo.fr> wrote:
> Hello,
> I would like to filter the files uploaded, I thought a good way was to
> use the file content type but I realized that it is often
> application/octet-stream regardless to the file uploaded (.doc, .xls,
> .pdf, .txt...).
>
> Am I obliged to filter based on the file extension or there is something
> to tweak to get a more explicit content-type value?
>
> Thanks
>
> Xavier
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [fileUpload] file content-type

Posted by Martin Cooper <ma...@apache.org>.
On 4/17/06, Xav <xx...@wanadoo.fr> wrote:
>
> Hello,
> I would like to filter the files uploaded, I thought a good way was to
> use the file content type but I realized that it is often
> application/octet-stream regardless to the file uploaded (.doc, .xls,
> .pdf, .txt...).
>
> Am I obliged to filter based on the file extension or there is something
> to tweak to get a more explicit content-type value?


The content type for an individual part is specified by the browser (or
other client), so to affect it, you would need to modify the browser's
settings. Unless you have a very controlled user base, that's probably not
practical, so you'd need to determine the actual content type yourself.

--
Martin Cooper


Thanks
>
> Xavier
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>