Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

add file u form2mail kako?

[es] :: PHP :: add file u form2mail kako?

[ Pregleda: 1766 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

jannako
slo

Član broj: 114404
Poruke: 7
193.77.24.*



Profil

icon add file u form2mail kako?11.10.2006. u 08:28 - pre 213 meseci
Imam kontakt forma koja radi odlicno, samo imam problem sa dodavanje fajla. U dreamweaver-ju sam dodao object za dodavanje fajla (text polje sa Browse dugme) i mi ne radi. Form je sledeci:
<form action=form2mail.php method=POST enctype="multipart/form-data">
<table width="370" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td><table width="360" border="0" align="center" cellpadding="3" cellspacing="1">
<tr bgcolor="#FFFFFF">
<td align="right">ime<font size="2" face="Verdana, Arial, Helvetica, sans-serif">:
</font></td>
<td align="left"><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="name" type="text" id="name" size="25">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">razred:</td>
<td align="left"><select name="select">
<option>I</option>
<option>II</option>
<option>III</option>
<option>IV</option>
<option>V</option>
<option>VI</option>
<option>VII</option>
<option>VIII</option>
</select></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="27" align="right">skola:</td>
<td align="left"><input name="textfield" type="text" size="25"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">grad:</td>
<td align="left"><input name="textfield2" type="text" size="25"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">E-mail:</td>
<td align="left"><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="email" type="text" id="email" size="25">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">Dodaj datoteka:</td>
<td align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="doc" type="file" id="doc2" size="25">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right">Poraka:</td>
<td align="left"><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="textarea" cols="32" rows="5"></textarea>
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" align="center"><input name="Submit" type="submit" value="Prati"></td>
</tr>
</table></td>
</tr>
</table>
</form>

a form2mail.php je sledeci:

<?php
# You can use this script to submit your forms or to receive orders by email.
$MailToAddress = "[email protected]"; // your email address
$redirectURL = "thanks1.php"; // the URL of the thank you page.

# optional settings
$MailSubject = "[Form - web]"; // the subject of the email
$MailToCC = ""; // CC (carbon copy) also send the email to this address (leave empty if you don't use it)
# in the $MailToCC field you can have more then one e-mail address like "[email protected], [email protected], [email protected]"

# If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".
# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.

# If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"
# you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>
# you have to do the same with checkboxes

# T
#

# SPAMASSASSIN RATING: 0.4

# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================
# ver. 1.6.2
if (preg_match ("/".$_SERVER["SERVER_NAME"]."/i", $_SERVER["HTTP_REFERER"])) {
$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body>";
if (count($_GET) >0) {
reset($_GET);
while(list($key, $val) = each($_GET)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$w4fMessage .= "$vala, ";
}
$w4fMessage .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>"; }
}
}
} // end while
}//end if
else {
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$w4fMessage .= "$vala, ";
}
$w4fMessage .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>"; }
}
}
} // end while
}//end else
$w4fMessage = "<font face=verdana size=2>".$w4fMessage."</font></body></html>";
if (!$email) {$email = "[email protected]";}
if (!mail($MailToAddress, $MailSubject, $w4fMessage, "From: $name <$email>\r\nReply-To: $name <$email>\r\nMessage-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\nMIME-Version: 1.0\r\nX-Priority: 3\r\nX-Mailer: PHP/" . phpversion()."\r\nX-MimeOLE: Produced By Web4Future Easiest Form2Mail v1.5\r\nBCc: $MailToCC\r\nContent-Type: text/html; charset=ISO-8859-1\r\nContent-Transfer-Encoding: 8bit\r\n")) { echo "Porakata ne e pratena!";}
else { header("Location: ".$redirectURL); }
} else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}
?>
 
Odgovor na temu

smurflander
Sasa Taskov
PHP Developer
Nis

Član broj: 97546
Poruke: 70
*.vdial.verat.net.



+22 Profil

icon Re: add file u form2mail kako?17.10.2006. u 22:16 - pre 213 meseci
U form2mail-u ne postoji potreban kod za slanje fajlova. trebas ga sam napisati.

Evo ti kod pa pokusaj da ga integrises i form2mail fajlu.


for ($i=1;$i<=10;$i++)

{
$imefajla="atach".$i;
echo $HTTP_POST_FILES[$imefajla]['name'];

if (!is_array ($HTTP_POST_FILES[$imefajla]))
{
echo $HTTP_POST_FILES[$imefajla];
continue;
print ('<html><body>You didn\'t upload a file</body></html>');

}

$f =& $HTTP_POST_FILES[$imefajla]; // saves typing
$dest_dir = 'images/big/';
$dest = $dest_dir . '/' . $f['name'];

if (!is_uploaded_file ($f['tmp_name']))
{
continue;
print ('<html><body>Error: No file uploaded.</body></html>');

}
if (!file_exists ($dest_dir))
{
$aa=$HTTP_REFERER;
print ('<html><body>Error: Destination directory "' .
$dest_dir . '" does not exist!</body></html>');
exit;
}
if (!is_dir ($dest_dir))
{
$aa=$HTTP_REFERER;
print ('<html><body>Error: Destination directory "' .
$dest_dir . '"is not a directory!</body></html>');
exit;
}
if (file_exists ($dest))
{
$aa=$HTTP_REFERER;
print ('<html><body>Error: File "' . $dest .
'" already exists!</body></html>');
exit;
}

// all clear, move the file to its permanent location
$r = move_uploaded_file ($f['tmp_name'], $dest);
 
Odgovor na temu

[es] :: PHP :: add file u form2mail kako?

[ Pregleda: 1766 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.