Problem with file type field
Archived from the Xataface Users forum.
andperry — Wed Jan 06, 2010 10:55 am
I have included the following field definition in the INI file for a table:-
[image]
visibility:list = hidden
widget:description = “Image file (N.B. Must be type JPG).”
widget:atts:size = 80
Type = container
widget:type = file
allowed_extensions = jpg
savepath = ../images/events
url = /images/events
When attempting to edit a record the following message appears at the top of the page:-
Warning: mime_magic: invalid mode 027774671400. in /home/sites/fairangelevents.co.uk/public_html/xataface-1.1.5/Dataface/Record.php on line 2216
When attempting to save the record with a file to upload, the above message plus the message below are displayed:-
Warning: Cannot modify header information - headers already sent by (output started at /home/sites/fairangelevents.co.uk/public_html/xataface-1.1.5/Dataface/Record.php:2216) in /home/sites/fairangelevents.co.uk/public_html/xataface-1.1.5/actions/edit.php on line 189
What is most puzzling is the fact that I have lifted the INI file data straight from another project where everything works fine. Only the savepath and url are different.
Can anyone help please?
Regards,
Andrew Perry.
shannah — Wed Jan 06, 2010 11:27 am
Looking up this error on google, I find the following:
Source: http://algorytmy.pl/doc/php/function.mi … t-type.php
It would seam that this funktion has a tendency to report
Warning: mime_magic: invalid mode 01002354664
if the the filename has a + in it.
(php 4.3)
Source: http://forum.prothemedesign.com/topic/m … valid-mode
mime_magic isn’t in Pear(5) or PECL(5). And it’s also depecated, in favor of Fileinfo
In any case, assuming that this error isn’t a symptom of something serious, we can just suppress the warning by modifying the following line in Dataface/Record.php (I believe this is line 2216 in your version of Dataface/Record.php (version 1.1.5?):
- Code: Select all
$mimetype = mime_content_type($path);
So that it becomes:
- Code: Select all
$mimetype = @mime_content_type($path);
Best regards
Steve