Yellow
I have worked on this for a while, but either I'm blind or there's something wrong. (but probably both!)
I have a form, through which the user can get some data saved to the server.
The file is saved under the name of the "name" input with txt extension. The file (an image) is supposed to be saved either as "name".gif or "name".jpg depending on what type it is in a subdirectory.
Now it works fine for .gif. I get just the result I want, but it does not accept the .jpg files (it doesn't print out an error but doesn't do anything either
Please I you have any idea...
Thanx
Below is my the code
FORM.HTML
<FORM enctype="multipart/form-data" ACTION="get.php3" method="post">
<b>Name:</b><BR><INPUT name="name" type="text" size="55"><BR>
<b>Image:</b><BR><input type="file" name="img1" size="30"></p>
<b>Your comment:</b><BR><TEXTAREA name="text" rows=10 cols=55 wrap=virtual>
</TEXTAREA><BR>
<INPUT type="submit" value="Post your comments">
</FORM>
This form is sent to
GET.PHP3
if ( isset( $img1 ) )
{
if ( $img1_type == "image/jpg" )
{
$fileName1 = "$name".".jpg";
copy ( $img1, "bilder/$fileName1") or die ( "<b>Warnung!</b> Datei konnte nicht gespeichert werden!" );
$message = "<B>$name </B><P> $text <BR>
<IMG SRC=\"bilder/$fileName1\"> <BR><HR>";
$fp = @fopen("$name.txt","w");
fwrite($fp, $message);
fclose($fp);
}
elseif ( $img1_type == "image/gif" )
{
$fileName2 = "$name".".gif";
copy ( $img1, "bilder/$fileName2") or die ( "<b>Warnung!</b> Datei konnte nicht gespeichert werden!" );
$message = "<B>$name </B><P> $text <BR>
<IMG SRC=\"bilder/$fileName2\"> <BR><HR>";
$fp = @fopen("$name.txt","w");
fwrite($fp, $message);
fclose($fp);
}
}
print "Die Datei wurde erfolgreich gespeichert";