Re: [symfony-users] Re: File upload and mime type detection issues
btw - zip for docx is not that far off. docx-files are essentially zipped xml-files ;) sincerely louis 2011/6/17 Gustavo Adrian comfortablynum...@gmail.com: Thanks for the tip! Yes, this topic is a real headache. I had this type of issue on centos too (although I don't remember with which filetypes). For now I'm handling this problem in the insecure way.. using the mime and extension sent by the browser, and marking the file as insecure in that case. It's the only way I can make it work. None of the three mime type guessers works. I have problems with several file types, including the one you mention. BTW, after updating yesterday Symfony 2 I saw that File classes that handle the uploaded files have changed. I was using UploadedFile::getExtension to get the extension, but now it returns an empty string. It uses pathinfo to get the extension. I didn't have a deep look at it so I'm not sure why this happens. I mention it only if it's relevant to someone. In my case I'm just getting the extension from the original name for now (because the guessExtension obviusly is not working if the mime type is wrong. For a .docx it's giving me a '.zip' extension). I'd like to keep this message alive in case anyone has more comments like yours about this which are helpful in this topic. Thanks! 2011/6/17 matteosister matt...@gmail.com yes same problem here. I'm on ubuntu too. I' think it's a problem bound to proprietary file types. Take a look at /etc/mime.types for mime supported by your system. For me the problem comes with .doc documents. It says that it is a application/vnd.ms-office instead of ms-word This is why microsoft sucks. On 17 Giu, 15:22, Gustavo Adrian comfortablynum...@gmail.com wrote: Is someone having this issue? 2011/6/16 Gustavo Adrian comfortablynum...@gmail.com Hi all, I wanted to ask you guys if you've found a definitive way to handle mime type detection issues. I recently implemented file upload handling in my app with Symfony 2 and I'm having problems detecting, for example, .docx files. When I upload a .docx, it detects a mime type of application/zip. I have this issue with other file types too (like .csv). I know this is not a Symfony 2 specific problem, I had this problem before, but I'd like to know what do you think about this. I'm using right now: Apache 2.2.16 PHP 5.3.3 Ubuntu 11 and I have FileInfo v1.0.5-dev How do you handle this situations? Thanks. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: File upload and mime type detection issues
Yes. You can even open the zip without problems. But anyway that's not the correct mime type. And it's not the only case it detects the wrong mime type. That's why I, sadly, have to use the original extension and mime type until I find a better and consistent solution. I know it's not the best way to handle uploads but I have no choice for now. If anyone finds a fix for this issue or a better way to handle it, please let me know. @matteosister: method guessExtension, in the case of some .docx will return .zip, at least in my case (Ubuntu + Apache 2). And I had problems with getExtension method last time I tried, after updating Symfony on friday. It always returns null. I don't know if this was fixed in the last couple of days. I'm not at work today so tomorrow I'll check that again. I saw someone reporting this issue this weekend. 2011/6/17 Louis Huppenbauer louis.huppenba...@gmail.com btw - zip for docx is not that far off. docx-files are essentially zipped xml-files ;) sincerely louis 2011/6/17 Gustavo Adrian comfortablynum...@gmail.com: Thanks for the tip! Yes, this topic is a real headache. I had this type of issue on centos too (although I don't remember with which filetypes). For now I'm handling this problem in the insecure way.. using the mime and extension sent by the browser, and marking the file as insecure in that case. It's the only way I can make it work. None of the three mime type guessers works. I have problems with several file types, including the one you mention. BTW, after updating yesterday Symfony 2 I saw that File classes that handle the uploaded files have changed. I was using UploadedFile::getExtension to get the extension, but now it returns an empty string. It uses pathinfo to get the extension. I didn't have a deep look at it so I'm not sure why this happens. I mention it only if it's relevant to someone. In my case I'm just getting the extension from the original name for now (because the guessExtension obviusly is not working if the mime type is wrong. For a .docx it's giving me a '.zip' extension). I'd like to keep this message alive in case anyone has more comments like yours about this which are helpful in this topic. Thanks! 2011/6/17 matteosister matt...@gmail.com yes same problem here. I'm on ubuntu too. I' think it's a problem bound to proprietary file types. Take a look at /etc/mime.types for mime supported by your system. For me the problem comes with .doc documents. It says that it is a application/vnd.ms-office instead of ms-word This is why microsoft sucks. On 17 Giu, 15:22, Gustavo Adrian comfortablynum...@gmail.com wrote: Is someone having this issue? 2011/6/16 Gustavo Adrian comfortablynum...@gmail.com Hi all, I wanted to ask you guys if you've found a definitive way to handle mime type detection issues. I recently implemented file upload handling in my app with Symfony 2 and I'm having problems detecting, for example, .docx files. When I upload a .docx, it detects a mime type of application/zip. I have this issue with other file types too (like .csv). I know this is not a Symfony 2 specific problem, I had this problem before, but I'd like to know what do you think about this. I'm using right now: Apache 2.2.16 PHP 5.3.3 Ubuntu 11 and I have FileInfo v1.0.5-dev How do you handle this situations? Thanks. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on
Re: [symfony-users] Re: File upload and mime type detection issues
Thanks for the tip! Yes, this topic is a real headache. I had this type of issue on centos too (although I don't remember with which filetypes). For now I'm handling this problem in the insecure way.. using the mime and extension sent by the browser, and marking the file as insecure in that case. It's the only way I can make it work. None of the three mime type guessers works. I have problems with several file types, including the one you mention. BTW, after updating yesterday Symfony 2 I saw that File classes that handle the uploaded files have changed. I was using UploadedFile::getExtension to get the extension, but now it returns an empty string. It uses pathinfo to get the extension. I didn't have a deep look at it so I'm not sure why this happens. I mention it only if it's relevant to someone. In my case I'm just getting the extension from the original name for now (because the guessExtension obviusly is not working if the mime type is wrong. For a .docx it's giving me a '.zip' extension). I'd like to keep this message alive in case anyone has more comments like yours about this which are helpful in this topic. Thanks! 2011/6/17 matteosister matt...@gmail.com yes same problem here. I'm on ubuntu too. I' think it's a problem bound to proprietary file types. Take a look at /etc/mime.types for mime supported by your system. For me the problem comes with .doc documents. It says that it is a application/vnd.ms-office instead of ms-word This is why microsoft sucks. On 17 Giu, 15:22, Gustavo Adrian comfortablynum...@gmail.com wrote: Is someone having this issue? 2011/6/16 Gustavo Adrian comfortablynum...@gmail.com Hi all, I wanted to ask you guys if you've found a definitive way to handle mime type detection issues. I recently implemented file upload handling in my app with Symfony 2 and I'm having problems detecting, for example, .docx files. When I upload a .docx, it detects a mime type of application/zip. I have this issue with other file types too (like .csv). I know this is not a Symfony 2 specific problem, I had this problem before, but I'd like to know what do you think about this. I'm using right now: Apache 2.2.16 PHP 5.3.3 Ubuntu 11 and I have FileInfo v1.0.5-dev How do you handle this situations? Thanks. -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en