Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wysyłanie załącznika w formularzu, problem z fileopenanddecode()
motor
post
Post #1





Grupa: Zarejestrowani
Postów: 211
Pomógł: 0
Dołączył: 15.12.2005

Ostrzeżenie: (0%)
-----


Witam skorzystałem z gotowego skryptu który znalazłem na forum tzn:

http://php.webhelp.pl/index.php?id=106&roz=php&ac=read


Wyskakuje mi taki błąd
Fatal error: Call to undefined function: fileopenanddecode() in

Nie wiem co jest grane jak mogę to obejść ?

Pozdrawiam

Ten post edytował motor 2.02.2006, 18:48:30
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
motor
post
Post #2





Grupa: Zarejestrowani
Postów: 211
Pomógł: 0
Dołączył: 15.12.2005

Ostrzeżenie: (0%)
-----


nie nie przpisałem słowo w słowo
  1. <?    
  2.  if($tak == "1"){
  3.  
  4.         
  5. ///
  6. $boundary = "-->===_54654747_===<---->>4255==_"; 
  7. $sendto ="zundap@vp.pl";
  8. // Zmiennych $subject i $sendto nie  musimy w zaden sposób przerabiac. 
  9.  
  10. // Teraz trzeba sformatowac naglówek. 
  11. $from = "biuro@nokto.pl.net"  ;
  12.         $head = "From: $from\n"; 
  13.         $head = $head . "Reply-To: $a_row[title]\n"; 
  14.         $head = $head . "X-Mailer: php\n"; 
  15.         $head = $head . "X-Sender: $from\n"; 
  16.         $head = $head . "MIME-version: 1.0\n"; 
  17.         $head = $head . "Content-type: multipart/mixed; "; 
  18.         $head = $head . "boundary=\"$boundary\"\n"; 
  19.         $head = $head . "Content-transfer-encoding: 7BIT\n"; 
  20.         $head = $head . "X-attachments: $filename_name;\n\n"; 
  21.  
  22. // Jeszcze tylko tresc wiadomosci i  mozemy slac poczte  
  23.  
  24.        $mesg = "--" . $boundary . "\n";    //pamietamy dwa minusy na poczatku 
  25.         $mesg = $mesg . "Content-Type: text/plain; charset=\"us-ascii\"\n\n"; 
  26.         $mesg = $mesg . $message . "\n"; 
  27.         $mesg = $mesg . "--" . $boundary . "\n";    //pamietamy dwa minusy na poczatku 
  28.          $mesg = $mesg . "Content-type: " . $filename_type  . "; name=\"$filename_name\";\n";         
  29.         $mesg = $mesg . "Content-Transfer-Encoding: base64\n"; 
  30.         $mesg = $mesg . "Content-disposition: attachment; filename= \"$filename_name\"\n\n"; 
  31.         $mesg = $mesg . fileopenanddecode($filename) . "\n";   //czytamy plik i go kodujemy 
  32.         $mesg = $mesg . "--" . $boundary . "-- \n"; //pamietamy dwa minusy na poczatku  i na koncu 
  33.  
  34.  
  35.  
  36. //funkcja odczytujaca plik i kodujaca go d o formatu base64 zgodnie z RFC 2045 
  37.     function fileopenanddecode($file) { 
  38.         if (is_readable($file)) { 
  39.              $fd = fopen($file, "r"); 
  40.              $plik = fread($fd, filesize($file)); 
  41.              $encoded = chunk_split(base64_encode($plik)); 
  42.              fclose($fd);     
  43.         } 
  44.         return $encoded; 
  45.     } 
  46.  
  47. // i to wszystko teraz tylko  
  48. mail($sendto, $subject, $mesg, $head);  
  49. //i poszlo 
  50.  
  51. ///
  52.  
  53.             
  54.                 
  55.             
  56.             }else{
  57.             ?>
  58. <form name="form1" method="post" action="wyslij.php?&tak=1" enctype="multipart/form-data"> 
  59. <table width="300" border="0" cellspacing="0" cellpadding="0"> 
  60. <tr><td>subject</td><td><input type="text" name="subject"></td></tr> 
  61. <tr><td>replayto</td><td><input type="text" name="replayto"></td></tr> 
  62. <tr><td>from</td><td><input type="text" name="from"></td></tr> 
  63. <tr><td>message</td><td><textarea name="message" wrap="VIRTUAL"></textarea></td></tr> 
  64. <tr><td>filename</td><td><input type="file" name="filename"></td></tr> 
  65. <tr><td colspan="2"><input type="submit" name="Submit" value="Submit"></td></tr> 
  66. </table> 
  67. </form> 
  68. <?
  69. }
  70.             ?>    


Ten post edytował motor 2.02.2006, 18:55:54
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 16:29