-1
我的表結構插入MySQL中的圖像,我想通過JSP和Servlet
P_Id Int Primary key
Cat_Id Int Foreign key
Product_Name Nvarchar(50) Not Null
Model_No Nvarchar(50) Not Null
Price Numeric(10,2) Not Null
Photo mediumblob Not Null
Available Varchar(5) Not Null
Display Nvarchar(10) Not Null
Processor Nvarchar(50) Not Null
Platform Nvarchar(50) Not Null
Simcard Nvarchar(50) Not Null
Memory Nvarchar(20) Not Null
Pcamera Nvarchar(50) Not Null
Scamera Nvarchar(50) Not Null
Battery Nvarchar(30) Not Null
Ram Nvarchar(20) Not Null
這是我的jsp頁面
<form id="form1" action="UploadDBServlet" enctype="multipart/form-data" method="post">
<h2 align="center"> Add Product Here:</h2>
<table border="1" bgcolor="grey" style="color:blue">
<tr>
<td>
<!-- <b>Product_id</b> -->
</td>
<td>
<input type="hidden" name="pd" />
</td>
</tr>
<tr>
<td>
<b>Product Category:</b>
</td>
<td>
<select name="product">
<option value="Sony Ericsson">Sony Ericsson</option>
<option value="Nokia">Nokia</option>
<option value="Htc">HTC</option>
<option value="Samsung">Samsung</option>
<option value="micromax">Micromax</option>
</select>
</td>
</tr>
<tr>
<td>
<b>Product Name:</b>
</td>
<td>
<input type="text" name="pname">
</td>
</tr>
<tr>
<td>
<b>Model No:</b>
</td>
<td>
<input type="text" name="mnum">
</td>
</tr>
<tr>
<td>
<b>Price:</b>
</td>
<td>
<input type="text" name="price">
</td>
</tr>
<tr>
<td>
<b>Photo:</b>
</td>
<td>
<input type="file" name="Photo" value="" />
</td>
</tr>
<tr>
<td><b>Availability:</b></td>
<td>Yes <input type="radio" name="al"> No <input
type="radio" name="al">
</td>
</tr>
<tr>
<td><b>Display:</b></td>
<td><input type="text" name="disp"></td>
</tr>
<tr>
<td><b>Processor:</b></td>
<td><input type="text" name="proc"></td>
</tr>
<tr>
<td><b>Platform:</b></td>
<td><input type="text" name="plat"></td>
</tr>
<tr>
<td><b>Sim Card:</b></td>
<td><input type="text" name="sim"></td>
</tr>
<tr>
<td><b>Memory:</b></td>
<td><input type="text" name="mem"></td>
</tr>
<tr>
<td><b>Primary Camera:</b></td>
<td><input type="text" name="pc"></td>
</tr>
<tr>
<td><b>Secondary Camera:</b></td>
<td><input type="text" name="sc"></td>
</tr>
<tr>
<td><b>Battery:</b></td>
<td><input type="text" name="bat"></td>
</tr>
<tr>
<td><b>Ram:</b></td>
<td><input type="text" name="ram"></td>
</tr>
<tr>
<td><input type="submit" value="Add Product" id="box"></td>
<td><input type="reset" value="Reset" id="box"></td>
</tr>
</table>
</form>
任何幫助表示讚賞。
在此先感謝
我正在開發在線移動購物項目,所以我想添加產品圖像在database.is任何其他方式來做,請告訴如何做到這一點給我一些代碼samples.thanks爲你的迴應 – user3301393