Upload`owanie obrazku do bazy

PHP/MYSQL  Założony przez  GiboneKPL.

Witam. Robię jeden taki plugin i potrzebuje funkcji do wgrywania pliku *.img na serwer oraz do bazy danych. Jako, ze korzystam na forum z pluginu profilebackground pomyślałem, ze podejrzę sobie kod. Zrobiłem coś takiego:
$img $_FILES['img']['tmp_name'];
 
$ext get_extension(my_strtolower($img['img']));
$filename "img_".$mybb->get_input('id').".".$ext;
$file upload_file($img"./uploads/raportets/"$filename); 

Oczywiście na początku pliku jest:
require_once MYBB_ROOT."inc/functions_upload.php"

A dodawanie do bazy wygląda tak:
$raport = array(
 
"id" => $mybb->get_input('id'1),
"uid" => $mybb->get_input('uid'1),
"img" => $db->escape_string($filename),
);
$db->insert_query("raportets"$raport); 

A szablon:
<form action="raport.php?action=add_new_raport" method="post" name="input">
<input type="hidden" name="uid" value="{$mybb->user['uid']}" />
<input type="hidden" name="id" value="{$row['id']}" />
<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2">Tutaj nazwa tabelki</td>
</tr>
<tr>
<td class="trow1" style="text-align: center;">Obrazek img<br />
<input type="file" name="img" size="25" class="fileupload" accept="image/jpeg,image/jpg,image/png"/>
</td>
</tr>
<tr>
<td class="tcat" colspan="2" style="text-align: center;"><input type="submit" name="submit" value="Wyślij" class="button"/></td>
</tr>
</table>
</form>

I teraz tak:
Pliku nie uploaduje na serwer a kolumna w bazie danych wygląda tak:
http://scr.hu/78l2/ubvkm


Nie wiem co robię źle. Proszę o nakierowanie :D
Cześć Gibonku
Skoro bierzesz za to pieniądze to zrób to sam
ehh

sam formularz jest zle zbudowany, brakuje atrybutu w znaczniku form
Zrobiłem tak:
<form action="raport.php" method="post" enctype="multipart/form-data">
    <input type="hidden" name="uid" value="{$mybb->user['uid']}" />
    <input type="hidden" name="id" value="{$row['id']}" />
    <input type="hidden" name="action" value="add_new_raport" />
<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2">Tutaj nazwa tabelki</td>
</tr>
<tr>
<td class="trow1" style="text-align: center;">Obrazek img<br />
<input type="file" name="img" size="25" class="fileupload" accept="image/jpeg,image/jpg,image/png"/>
</td>
</tr>
<tr>
<td class="tcat" colspan="2" style="text-align: center;"><input type="submit" name="submit" value="Wyślij" class="button"/></td>
</tr>
</table>
</form>

Still nie działa, nie mam pomysłów więcej :/



Użytkownicy przeglądający ten wątek:

1 gości