image upload.... take 2
Posted: Tue Oct 18, 2005 5:03 am
feyd | Please use
I get no error and no upload... blank screen... He?
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Im trying to upload an image ( with description, price .. ) on remote server...
The code for localhost:Code: Select all
<form method="POST" action="" enctype="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="10000">
<table>
<tr>
<td width="13%">Picture</td>
<td width="87%"><input type="file" name="imagefile" size="28"></td>
</tr>
<tr>
<td width="13%">Price:</td>
<td width="87%"><input type="text" name="cijena" size="28"></td>
</tr>
<tr>
<td width="13%">Description:</td>
<td width="87%"><textarea rows="5" name="txtDescription" cols="23"></textarea></td>
</tr>
</table>
<p align="center"><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="B2"></p>
</form>
<?
$cnxdb = mysql_connect("localhost", "", "") or die("Could not connect: " . mysql_error());
mysql_select_db("theBase");
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ( ($_FILES['imagefile']['type'] == "image/gif") || ($_FILES['imagefile']['type'] == "image/pjpeg") ){
copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy.....");
$strDescription = addslashes(nl2br($txtDescription));
$imagefile = $_FILES['imagefile']['name'];
$query = "INSERT INTO pictures (imageid, imeSlike, opis, cijena) VALUES ('', '$imagefile', '$strDescription', '$cijena')";
mysql_query($query, $cnxdb);
echo "";
echo "Name: ".$name."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
else {
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
}
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]