formfields.com Forum Index formfields.com
FORMfields Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

file_get_contents

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> FF 2.X - Bug Reports
View previous topic :: View next topic  
Author Message
nado



Joined: 29 Mar 2006
Posts: 16

PostPosted: Wed May 03, 2006 6:38 am    Post subject: file_get_contents Reply with quote

This seems to be an issue for a few people and I still haven't found an answer for it yet.

I had a search around and some said it was a big in PHP 4.2.1, but I upgraded to PHP5 and still getting the same error.

It doesn't seem to like this line which looks like the file attachment in the email:

Code:
. chunk_split(base64_encode(file_get_contents($attachment[0]))) . "\n";


Is there a way to disable the email attachments and stop this error or some other way to fix it?

cheers
nathan
Back to top
View user's profile Send private message
nado



Joined: 29 Mar 2006
Posts: 16

PostPosted: Fri May 05, 2006 11:53 am    Post subject: Reply with quote

Does anyone know how to fix this?
Back to top
View user's profile Send private message
formfields



Joined: 01 Aug 2005
Posts: 465

PostPosted: Mon May 08, 2006 2:00 pm    Post subject: Reply with quote

If you are using an UploadField and are getting an error like the following (line numbers may be slightly different):
Code:

Warning: file_get_contents(): URL file-access is disabled in the server configuration in /home/content/g/o/e/goexpo/html/FORMfields/FORMfields.php on line 783

Warning: file_get_contents(http://goexposoftware.com/FORMfields/uploads/bday-banner-1147096470.txt): failed to open stream: no suitable wrapper could be found in /home/content/g/o/e/goexpo/html/FORMfields/FORMfields.php on line 783

then this is most likely because your web host has set allow_url_fopen = off in your php.ini file. Recently, some web hosts have begun to set this option to off. At this point, it is mandatory that this option be set to on in order for the UploadFields to function properly. This can usually be achieved by either:
1. Using an FTP program to go to the root directory of your website, downloading the php.ini file, editing the file so that allow_url_fopen = on, and then reuploading the php.ini file. (Like GoDaddy Hosting)
OR
2. If you don't have access to your php.ini file, by contacting your hosting company to have them make the change.
Back to top
View user's profile Send private message
nado



Joined: 29 Mar 2006
Posts: 16

PostPosted: Mon May 08, 2006 3:25 pm    Post subject: Reply with quote

Yep, I'm with dreamhost and they say in their wiki that I cannot edit the php.ini file, but here's a wiki entry for the all_url_fopen...

http://wiki.dreamhost.com/index.php/Allow_url_fopen

and

http://wiki.dreamhost.com/index.php/CURL


... although I'm not sure what to do?
Back to top
View user's profile Send private message
nado



Joined: 29 Mar 2006
Posts: 16

PostPosted: Tue May 09, 2006 11:46 am    Post subject: Reply with quote

any ideas?
Back to top
View user's profile Send private message
formfields



Joined: 01 Aug 2005
Posts: 465

PostPosted: Tue May 09, 2006 10:03 pm    Post subject: Reply with quote

Here is a way to modify FORMfields.php so that it doesn't cause any problems with allow_url_fopen = on. Open FORMfields.php and edit FormBean::email() by replacing the line:
Code:

   $attachment = array($this->formFields[$key]->uploadedFile, basename(str_replace("\\", "/", stripslashes($this->formFields[$key]->uploadedFile))));

with:
Code:

   // 2006.05.09
   // If allow_url_fopen = off then the file path must be a local path
   //$attachment = array($this->formFields[$key]->uploadedFile, basename(str_replace("\\", "/", stripslashes($this->formFields[$key]->uploadedFile))));
   $filename = basename(str_replace("\\", "/", stripslashes($this->formFields[$key]->uploadedFile)));
   $attachment = array($this->formFields[$key]->uploadDir . "/" . $filename, $filename);
Back to top
View user's profile Send private message
nado



Joined: 29 Mar 2006
Posts: 16

PostPosted: Tue May 09, 2006 11:38 pm    Post subject: Reply with quote

awesome, thanks heaps, you're a champ!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    formfields.com Forum Index -> FF 2.X - Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group