Image Upload Warning: finfo_file() expects …

Archived from the Xataface Users forum.

chichi — Thu Jul 15, 2010 1:05 am

Hello, I get thios warning when using the container like this in fields.ini:

Code: Select all
[product_image] Type=container allowed_extensions="jpg,gif,png" visibility:list = hidden

Warning: finfo_file() expects at least 2 parameters, 1 given in /home/www/ad/Dataface/Record.php on line 2264

Is this an error i caused? When I place a file it uploads to the correct directory but gives a second info:

Warning: Cannot modify header information - headers already sent by (output started at /home/www/ad/Dataface/Record.php:2264) in /home/www/ad/actions/edit.php on line 186

I do need help on this, cause I want to use image-upload for my app.
Greetings chichi


cantlep — Thu Jul 15, 2010 2:35 am

Do you need a

Code: Select all
widget:type = file

in there?


chichi — Thu Jul 15, 2010 6:36 am

Thanks for the info I would like to use:

Code: Select all
widget:type = container

with this I get the warnings.

Code: Select all
widget:type = file

is working but I want to use container

chichi


chichi — Thu Jul 15, 2010 10:31 am

I did this, and its now working:

record.php

Code: Select all
if(extension_loaded('fileinfo')) { $res = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */ //$mimetype = finfo_file($path);  //<- I commented this out             }

It does not have an effekt on my app, as I can see so far, but the Error-Messages are gone and the files are uploaded correctly.
Steve, is this Ok or have I done a thing I should not do?

chichi


shannah — Thu Jul 15, 2010 11:59 am

Back to the previous post, I think your problem might be in your container declaration. You don’t use widget:type=container. It is just Type=container .

(Note capitals matter. it is Type and not type)

-Steve


chichi — Fri Jul 16, 2010 2:21 am

Thanks for the info,

I don’t use widget:type=container.
I use: Type=container

Error messages:
Warning: finfo_file() expects at least 2 parameters, 1 given in /home/www/ad/Dataface/Record.php on line 2264

I did comment out line 2264 on Record.php –> now its working fine. Dont know what Return gives back now, but files are uploaded and string is in the database.

chichi


cantlep — Fri Jul 16, 2010 7:21 am

I don’t use it but might this work

Code: Select all
[product_image] Type=container widget:type = file allowed_extensions="jpg,gif,png" visibility:list = hidden

So that both “widget:type” and “Type” are populated?


chichi — Sat Jul 17, 2010 4:23 am

Both are included:

Code: Select all
[product_image] Type=container widget:type = file

Still not working. Ca the timezone of the server play a role here? I am in Europe and we use 10.12.2010 instead of 12.10.2010. Do I have to override these settings for my applikation?

Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/Berlin’ for ‘CEST/2.0/DST’ instead in /home/www/ad/dataface-public-api.php on line 648

Questions:

Does my field for image Upload needs to be a special format in the mysql table: type: blob? or other mysql settings? image upload is not working on my system well.
I want my images to be stored in a directory.

chichi


shannah — Tue Jul 20, 2010 9:55 am

All of these questions are answered in this help doc:

http://xataface.com/documentation/how-t … le-uploads


iliakros — Tue Oct 19, 2010 1:49 am

I found a solution

Go to /Dataface/Record.php line 2264

change

$mimetype = finfo_file($path);

into

$mimetype = finfo_file($res, $path);

Iliakros


semicon_guy — Tue Oct 19, 2010 8:04 am

Thank you for posting this fix! I was having the same problem and following the help page instructions didn’t seem to fix it.


semicon_guy — Tue Oct 19, 2010 8:04 am

Thank you for posting this fix! I was having the same problem and following the help page instructions didn’t seem to fix it.