Connections-Business-Directory / Connections

Directory Plugin for WordPress
https://connections-pro.com
GNU General Public License v2.0
26 stars 18 forks source link

MIME type can't be detected. #340

Closed quantumJLBass closed 10 years ago

quantumJLBass commented 10 years ago

It seems that includes/libraries/php_class_upload/class.upload.php is not letting a csv file to be uploaded as it hits a ERROR: MIME type can't be detected. .. somed to throw the notice also on L~3011, 2966, 2939, 2899.

Still trying to root out why.

quantumJLBass commented 10 years ago

It seems that the production server is running php 5.5 .. I'm betting that is the issue here. still running it down.

quantumJLBass commented 10 years ago

Ok I already have the fix for this . It's in reference to the CSVImporter and I have replacement code that will handle this. I'll send a PR once I have had all the pressure off

quantumJLBass commented 10 years ago

So I corrected the usage that was the issue directly in the CSV importer, but, I have to imagine that I will see this issue raise again if I upload a picture in the core here. The class is n issue as preg_match is getting notice. It seems to me that the class functions could be replaced for core WP functions?

shazahm1 commented 10 years ago

Yes, I probably should use core WP functions... the class.upload.php is legacy code since when I started using it the core functions for images were very weak to non-existent. One of my releases this year will address removing the use of class.upload.php and timthumb (yeah!!!).

After some quick tests, I'll merge the pull. Thanks!

Side note to self: This must be the reason a small number of users have to upload as file-name.txt rather than file-name.csv.

quantumJLBass commented 10 years ago

The only thing it's missing is that the file stays in the end, but I would bet on some actin it could be removed at the end just fine too. Maybe I can do the work as I get the time on this to help speed up that timthumb removal, it is a high exploited script for hackers.

shazahm1 commented 10 years ago

The file delete probably can just be inserted here: https://github.com/Connections-Business-Directory/CSV-Import/blob/develop/connections_csv.php#L360

Any help with timthumb removal would be awesome. My high level plan is to create a cnImage class. I'm not sure if I want to just use the image processing code class.upload.php or fork this and add the missing features that I still use in timthumb; I'm definitely leaner towards the later. Whatever the final solution, I do want it to be a drop in replacement for timthumb where all I need to do is change the calling function name.

shazahm1 commented 10 years ago

The file will now upload using WP core functions to ../wp-content/uploads/csv_files and then delete after the import.