<.tr>
<.td>
<.!-- this is where the image to upload goes-->
Bild URL:

<.input type="text" name="bild" size="40">

<.tr>
<.td>
Text:

<.textarea cols="50" rows="10" name="text">


<.tr>
<.td>
Englischer Text:

<.textarea cols="50" rows="10" name="entext">


<.tr>
<.td>
<.input type="submit" name="submit" value="Submit">


    File Upload

    Date: 01/13/06 (PHP Community)    Keywords: no keywords

    I've got this small snippet for uploading an image, but it's not working. Anyone can help out? :)
    I get an error that I've got the wrong file type when I try to post something.



    <.h3>Zur Zeit im Studio - Neuer Eintrag
    <.form action="" method="post" enctype="multipart/form-data">
    <.table>
    <.tr>
    <.td>
    <.b>Band:
    <.input type="text" name="band" size="40">





$GLOBALS['UPLOAD_SIZES']['max']){return -1;}
$arrSegments = split('[.]', $strName);
$strExtension = $arrSegments[count($arrSegments) - 1];
if ($GLOBALS['UPLOAD_TYPES'][strtoupper($strExtension)] != 1) {return -2;}
return 1;}
$intResult = verify_uploaded_file(
$HTTP_POST_FILES['upload_file']['name'],
$HTTP_POST_FILES['upload_file']['size']);
if ($intResult != 1){
print ("

Error!");
if ($intResult == -1){die ($msg_base . 'The button is too large.

');}
elseif ($intResult == -2){die($msg_base . 'The only file types allowed are: JPG, JPEG, GIF, PNG.

');}
}if (! move_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'],
$MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']) ){die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']);}
*/
$sql = "INSERT INTO table(timestamp,band,bild,text,entext) VALUES ('$timestamp','$band','$bild','$text','$entext')";
$result = mysql_query($sql) or print ("Can't insert into table .
" . $sql . "
" . mysql_error());

if ($result != false)
{
print "Die Band wurde gepostet!";
}

mysql_close();
}

?>

Source: http://www.livejournal.com/community/php/394734.html

« Update / Seeking Guidance || PHP Frameworks »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home