tags:

views:

272

answers:

3

hi

i am using this script for the email attachment but when i execute the form on my server it shows to warning 1-Warning: fread(): supplied argument is not a valid stream resource

2-Warning: fclose(): supplied argument is not a valid stream resource

pls help

+3  A: 

Change this:

$fp = fopen($strresume, "rb"); 
$file = fread($fp, $strresume_size);

to this:

$fp = fopen($filetemp, "rb"); 
$file = fread($fp, $strresume_size);
Chacha102
i already set the permission of the file to 777
vipinsahu
View latest update.
Chacha102
justcheck it out http://s-series.co.in/rahul/careers.html
vipinsahu
so what should i do
vipinsahu
I would suggest echoing out each value before you test on it (`print_r($_FILES])` and seeing the data that is coming in.
Chacha102
okie Chacha102 thanks for helping me if u have any script similer like this thread plz put it here
vipinsahu
Oh! Now I know. change $strresume to $filetemp here: $fp = fopen($strresume, "rb");
Chacha102
can u correct this script ?
vipinsahu
I put the change needed in my answer.
Chacha102
still getting the same error
vipinsahu
+1  A: 

The script behaves differently as per hosting config. So either use file name in all places "$strresume" or use the variable it has assign to. i.e. $strname, $strtype, $strsize, $strtemp.

This works.

-sam

+1  A: 

I use this function to send HTML email with an attachment:

http://www.barattalo.it/2010/01/10/sending-emails-with-attachment-and-html-with-php/

Pons