| View previous topic :: View next topic |
| Author |
Message |
nado
Joined: 29 Mar 2006 Posts: 16
|
Posted: Wed May 03, 2006 6:38 am Post subject: file_get_contents |
|
|
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 |
|
 |
nado
Joined: 29 Mar 2006 Posts: 16
|
Posted: Fri May 05, 2006 11:53 am Post subject: |
|
|
| Does anyone know how to fix this? |
|
| Back to top |
|
 |
formfields
Joined: 01 Aug 2005 Posts: 465
|
Posted: Mon May 08, 2006 2:00 pm Post subject: |
|
|
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 |
|
 |
nado
Joined: 29 Mar 2006 Posts: 16
|
|
| Back to top |
|
 |
nado
Joined: 29 Mar 2006 Posts: 16
|
Posted: Tue May 09, 2006 11:46 am Post subject: |
|
|
| any ideas? |
|
| Back to top |
|
 |
formfields
Joined: 01 Aug 2005 Posts: 465
|
Posted: Tue May 09, 2006 10:03 pm Post subject: |
|
|
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 |
|
 |
nado
Joined: 29 Mar 2006 Posts: 16
|
Posted: Tue May 09, 2006 11:38 pm Post subject: |
|
|
| awesome, thanks heaps, you're a champ! |
|
| Back to top |
|
 |
|