Zdravím Vás tak som našiel tento php kód
Ide o to že súbor na server pošle aj vytvorí subor.txt ale nezapíše tam popis z webovej stránky,
v súbore.txt je zapísané 'Niečo na zápis' , neviem ako ďalej ďakujem za pomoc.
Tu je web
http://www.trainzsuflo.com/pridat%20fotografiu/index.php
Tu sú zmieňované kódy:
index.php viď:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Language" content="sk">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1250">
<title>Pridať fotografiu</title>
<meta name="keywords" content="Zeleznica zeleznicne fotografie">
<meta name="author" content="Peter Nebehaj">
<meta name="categories" content="železnica">
<meta name="generator" content="WYSIWYG Web Builder -
http://www.wysiwygwebbuilder.com">
<style type="text/css">
div#container
{
width: 1116px;
height: 652px;
margin-top: 0px;
margin-left: 0px;
text-align: left;
}
</style>
<style type="text/css">
body
{
background-color: #FFFFFF;
color: #000000;
}
</style>
</head>
<body>
<div id="container">
<div id="wb_Shape6" style="margin:0;padding:0;position:absolute;left:129px;top:217px;width:169px;height:294px;text-align:center;z-index:0;">
<img src="images/img0051.gif" id="Shape6" alt="" title="" style="border-width:0;width:169px;height:294px"></div>
<div id="wb_Shape1" style="margin:0;padding:0;position:absolute;left:129px;top:5px;width:873px;height:168px;text-align:center;z-index:1;">
<img src="images/img0045.gif" id="Shape1" alt="" title="" style="border-width:0;width:873px;height:168px"></div>
<div id="wb_TextArt1" style="margin:0;padding:0;position:absolute;left:547px;top:22px;width:433px;height:134px;text-align:center;z-index:2;">
<img src="images/img0046.png" id="TextArt1" alt="" title="" style="border-width:0;width:433px;height:134px"></div>
<div id="wb_Shape3" style="margin:0;padding:0;position:absolute;left:129px;top:177px;width:873px;height:35px;text-align:center;z-index:3;">
<img src="images/img0048.png" id="Shape3" alt="" title="" style="border-width:0;width:873px;height:35px"></div>
<div id="wb_Text4" style="margin:0;padding:0;position:absolute;left:415px;top:186px;width:263px;height:17px;text-align:left;z-index:4;">
<font style="font-size:13px" color="#000000" face="Book Antiqua"> Pridať fotografiu</font></div>
<div id="wb_Shape2" style="margin:0;padding:0;position:absolute;left:129px;top:516px;width:169px;height:35px;text-align:center;z-index:5;">
<img src="images/img0044.png" id="Shape2" alt="" title="" style="border-width:0;width:169px;height:35px"></div>
<div id="wb_Shape4" style="margin:0;padding:0;position:absolute;left:302px;top:516px;width:477px;height:35px;text-align:center;z-index:6;">
<img src="images/img0049.png" id="Shape4" alt="" title="" style="border-width:0;width:477px;height:35px"></div>
<div id="wb_Image1" style="margin:0;padding:0;position:absolute;left:137px;top:225px;width:152px;height:279px;text-align:left;z-index:7;">
<img src="images/kres2.jpg" id="Image1" alt="" border="0" style="width:152px;height:279px;"></div>
<div id="wb_Image2" style="margin:0;padding:0;position:absolute;left:787px;top:220px;width:209px;height:287px;text-align:left;z-index:8;">
<img src="images/951.jpg" id="Image2" alt="" border="0" style="width:209px;height:287px;"></div>
<div id="wb_Shape5" style="margin:0;padding:0;position:absolute;left:783px;top:217px;width:219px;height:294px;text-align:center;z-index:9;">
<img src="images/img0001.gif" id="Shape5" alt="" title="" style="border-width:0;width:219px;height:294px"></div>
<div id="wb_Shape7" style="margin:0;padding:0;position:absolute;left:783px;top:516px;width:219px;height:35px;text-align:center;z-index:10;">
<img src="images/img0002.png" id="Shape7" alt="" title="" style="border-width:0;width:219px;height:35px"></div>
<div id="wb_Text6" style="margin:0;padding:0;position:absolute;left:794px;top:525px;width:194px;height:17px;text-align:center;z-index:11;">
<font style="font-size:13px" color="#000000" face="Book Antiqua">Mail: pnebehaj</font><font style="font-size:13px" color="#000000" face="Arial">@</font><font style="font-size:13px" color="#000000" face="Book Antiqua">gmail.com</font></div>
<div id="wb_Image3" style="margin:0;padding:0;position:absolute;left:138px;top:12px;width:397px;height:154px;text-align:left;z-index:12;">
<img src="images/sks1.jpg" id="Image3" alt="" border="0" style="width:397px;height:154px;"></div>
<div id="Html1" style="position:absolute;left:409px;top:279px;width:269px;height:192px;z-index:13">
<html>
<head>
<script type="text/javascript">
function checkFileExt(form) {
val = form.uploadedfile.value;
ext = (val.substr(val.length-3,3)).toUpperCase();
if (ext!="JPG") {
document.getElementById("msg").innerHTML = "The file must be a JPEG (.jpg)";
return false;
} else
return true;
}
</script>
</head>
<body style="padding:20px;text-align:center">
<sub>Maximum file size: 1 MB</sub>
<form
name="fileForm"
action="uploadFile.php"
method="POST"
enctype="multipart/form-data"
onSubmit="return checkFileExt(this);">
Nahrať tento súbor na server:
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="uploadedfile" size=30 />
Info k fotke : <input type="text" name="subor"><br>
<?php if ($_GET['ftb']==1) {
echo "<p style=\"color:#ff0000\">The file was too big...</p>";
}?>
<p style="color:#ff0000" id="msg"></p>
<p><input type="submit" value="Upload!" /></p>
</form>
</body>
</html></div>
</div>
</body>
</html>
Tu som doplnil
Info k fotke : <input type="text" name="subor"><br>
A ten druhý je
upload.php viď:
<?php
$doUpload = true;
$target_path = "uploads/" . basename($_FILES['uploadedfile']['name']);
$errorcode = $_FILES['uploadedfile']['error'];
file_put_contents('subor.txt', 'Niečo na zápis');
if ($errorcode == 2) {
header('Location:index.php?ftb=1');
}
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "File (". $_FILES['uploadedfile']['name'] . ") uploaded.";
echo "<img src=\"{$target_path}\" />";
//zmaz subor ked musis
if (!$doUpload) { unlink($target_path);}
} else {
echo "File upload failed.";
echo '<br/>Here is some more debugging info:<br/>';
echo "<pre>";
print_r($_FILES);
echo "</pre>";
}
echo "<p><meta http-equiv=\"refresh\" content=\"4;url=http://www.trainzsuflo.com/Nahraný_na_server.php\">";
?>
Tu som doplnil toto
file_put_contents('subor.txt', 'Niečo na zápis');