You are here: Uploading pictures to server « All PHP « IT news, forums, messages
Uploading pictures to server

Posted by Morten Christiansen on 12/12/06 16:07

Hi

I having problems uploading pictures to a server...

i made this code to do the trick but just getting an error...

can someone plz. help?

<?
$gdir=$_REQUEST["dir"]; $file=$_REQUEST["fname"]; $besk=$_REQUEST["fri"];
$tag=$_REQUEST["dag"]; $mm=$_REQUEST["md"]; $yr=$_REQUEST["yy"];
$graf=$_REQUEST["foto"];
$dat=$tag."-".$mm."-".$yr;
include ("db.php");

if($file!=""){
$start=strripos($file,"\\");print "<br>";
$stop=strripos($file,".");print "<br>";
$onavn=substr($file, $start+1, strripos($file,"."));
$stop1=strripos($onavn,".");
$navn=substr($onavn, 0,$stop1);

print "Stien er: ".$file."og filen heder: ".$navn."<br>";
print "Beskrivelsen er: ".$besk."<br>";
print "Datoen er: ".$dat."<br>";
print "Fotografen er: ".$graf."<br>";
print "Filen gemmes i diret: ".stripslashes($gdir)."<br>";
// if ($file_type=="image/gif" || $file_type=="image/jpg" ||
$file_type=="image/png" || $file_type=="image/bmp"){

// Indsζtter tekst og billedets navn i databasen
//mysql_connect("localhost","xxx","xxx");
//mysql_select_db("xxxdb");
//$query = mysql_query("INSERT INTO billeder (billede, overskrift,
tekst)" . "VALUES ('$file_name','$overskrift','$tekst')");
print " test 1 ".stripslashes($file)." og test 3
".stripslashes($file)."billeder/".$gdir."/".$name;
// Lζgger billedet ind i mappen billeder
copy(stripslashes($file),"billeder/".$gdir."/".$name);
echo "Du har uploadet dette:<br>";
echo "<img src=\"billeder/$name\"><br>";
echo "$tekst";
//} else {
echo "Du mε kun uploade billeder (jpg, gif eller png)";
print " test 2 ".stripslashes($file);

//}

//$medlem=mysql_query("INSERT INTO pic VALUES (NULL,
'$navn','$besk','$dat','$garf','$gdir')") or die(mysql_error("Kunne ikke
εbne tabellen"));
}




?>
<form method='post' action='uploadpic.php' >
<table border="0" width="76%" id="table3">
<tr>
<td>
<table border="0" width="100%" id="table4">
<tr>
<td width="194"><font size="2" face="Arial">Billede der
uploades</font></td>
<td>
<input type="file" name="fname" size="79" style="font-size: 8pt;
font-family: Arial"></td>
</tr>
<tr>
<td width="194" valign="top"><font size="2" face="Arial">
Beskrivelse af billede</font></td>
<td><textarea rows="6" name="fri" cols="50"></textarea></td>
</tr>
<tr>
<td width="194"><font size="2" face="Arial">Hvornεr er
billedet taget (dato)</font></td>
<td>
<input type="text" name="dag" size="2" maxlength="2">-
<input type="text" name="md" size="2" maxlength="2">-
<input type="text" name="yy" size="4" maxlength="4">
(dd-mm-yyyy)
</td>
</tr>
<tr>
<td width="194"><font size="2" face="Arial">Fotografen (Char
navn)</font></td>
<td>
<select size="1" name="foto">
<?
$medlem=mysql_query("SELECT * FROM users") or die(mysql_error("Kunne
ikke"));
while($row=mysql_fetch_array($medlem)){
print "<option>".$row["brugernavn"]."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td width="194"><font size="2" face="Arial">Hvor skal
billedet gemmes</font></td>
<td><select size="1" name="dir">
<?
$medlem=mysql_query("SELECT * FROM biblioteker") or
die(mysql_error("Kunne ikke"));
while($row=mysql_fetch_array($medlem)){
print "<option>".$row["biblio"]."</option>";
}
?>
</select></td>
</tr>
</table>
<input type="submit" value="Upload" name="B1" style="font-family: Arial;
font-size: 8pt"><input type="reset" value="Nulstil" name="B2
style="font-family: Arial; font-size: 8pt"" style="font-size: 8pt;
font-family: Arial"></td>
</tr>
</table>
</form>

Error mesage is:

failed to open stream: No such file or directory in
C:\Apache2\htdocs\morten\wow-doa.dk\uploadpic.php

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация