Jump to content

Recommended Posts

Hi,

 

I am trying to upload photos to a mysql databse but with no luck. I'm not getting any error messages, the problem is that nothing appears in the database.

 

the form proccessor is as follows,

 

<?php

mysql_connect("localhost","adder","clifford");

mysql_select_db("real");

$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));

$result=MYSQL_QUERY("INSERT INTO items (continent,country,type,Email,Title,Abstract,Article,data,filename,filesize,filetype) ". "VALUES ('menuSubjectsDMA','menuFilesDMA','Catagory','$Email','$title','$message','$messagetwo','$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");

$id= mysql_insert_id();

print "<p>File ID: <b>$id</b><br>";

print "<p>File Name: <b>$form_data_name</b><br>";

print "<p>File Size: <b>$form_data_size</b><br>";

print "<p>File Type: <b>$form_data_type</b><p>";

print "To upload another file <a href=http://www.myroho.com/add.html> Click Here</a>";

?>

 

the form is as follows,

 

<FORM name=myform action=send-mail.php method=post enctype="multipart/form-data">

<table border="0" width="588" cellspacing="0" cellpadding="0" id="table9">

<tr>

<td width="574">

<table border="0" width="574" cellspacing="0" cellpadding="0" id="table10">

<tr>

<td width="14" height="28" background="line_left_corner_top.png"> </td>

<td height="28" background="line_top.png" width="546" colspan="3"> </td>

<td width="14" height="28" background="line_right_corner_top.png"> </td>

</tr>

<tr>

<td width="14" background="line_left.png" rowspan="35" bgcolor="#FFFFFF"> </td>

<td colspan="3" width="546" bgcolor="#FFFFFF"><font color="#00518D"><span class="style10">

Submit Articles to Roaming Hordes Magazine</span></font></td>

<td width="14" background="line_right.png" rowspan="35" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td colspan="3" width="546" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td colspan="3" width="546" bgcolor="#FFFFFF"><span class="style51">

Adding to the members' magazine is easy. Simply fill

out the form below to submit an article <small>(all fields are required to submit). </small></span></td>

</tr>

<tr>

<td colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">1</font></span><span class="style62"><font color="#EE7F01">.</font></span><span class="style62"> E<span class="style78">mail:</span></span></td>

<td bgcolor="#FFFFFF"> </td>

<td bgcolor="#FFFFFF"><label>

<input name="Email" type="text" id="Email" size="28" maxlength="250">

</label></td>

</tr>

<tr>

<td colspan="3" width="546" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td width="546" align="left" valign="top" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">2</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">T<span class="style78">itle:</span></span></td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td style="width: 421px" align="left" valign="top" bgcolor="#FFFFFF">

<input name="title" type="text" class="userpass" id="title" style="width: 421" value="" size="28" maxlength="250"></td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td style="width: 421px" align="left" valign="top" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF">

<span class="style58"><font color="#000000">(20 character limit)</font></span></td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td style="width: 421px" align="left" valign="top" height="20" bgcolor="#FFFFFF">

<span class="style58"><font color="#00518D"><em>i.e.</em> catchy description of article's content</font></span></td>

</tr>

<tr>

<td colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF">

<span class="style68"><font color="#EE7F01">3</font></span><span class="style62"><font color="#EE7F01">.</font>A<span class="style78">bstract:</span></span>

<p class="style58">

<font color="#00518D"><em>i.e.</em> short overview and introduction to full article</font></p>

<p class="style58"><font color="#000000">(300 character limit)</font></p>

<p> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td width="546" style="width: 421" bgcolor="#FFFFFF"><font size="1" face="arial, helvetica, sans-serif"><br>

<textarea name=message wrap=physical cols=50 rows=7 onKeyDown="textCounter(this.form.message,this.form.remLen,300);" onKeyUp="textCounter(this.form.message,this.form.remLen,300);"></textarea>

<br>

<input readonly type=text name=remLen size=3 maxlength=3 value="300">

<font face="Verdana, Arial, Helvetica, sans-serif">characters left</font></font><font face="Verdana, Arial, Helvetica, sans-serif"> </font> </td>

</tr>

<tr>

<td colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">4</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">A<span class="style78">rticle:</span></span>

<p><span class="style58">

<font color="#00518D"><em>i.e.</em> full article</font></span></p>

<p><span class="style58"><font color="#000000">(4000 character limit)</font></span></p>

<p> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"><font size="1" face="arial, helvetica, sans-serif"><br>

<textarea name=messagetwo wrap=physical cols=50 rows=7 onkeydown="textCounter(this.form.messagetwo,this.form.remLen2,4000);" onkeyup="textCounter(this.form.messagetwo,this.form.remLen2,4000);"></textarea>

<br>

<input readonly type=text name=remLen2 size=4 maxlength=4 value="4000"> characters left</font> </td>

</tr>

<tr>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF">

<span class="style86"><font color="#EE7F01">>></font>

<font color="#00518D"><a href="add%20item.html">

<font color="#00518D">Save article to personal email account</font></a> </font><font color="#EE7F01">>></font><font color="#EE7F01"></font><font color="#EE7F01"></font></span></td>

</tr>

<tr>

<td width="546" colspan="3" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">5</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">L<span class="style78">ocation:</span></span></td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"><select name="menuSubjectsDMA" onChange="changeFilesDMA()">

  <option value="none">Select a Continent

  <option value="">Africa

  <option value="">Asia

  <option value="">Europe

  <option value="">North America

  <option value="">Oceania

  <option value="">South America

  </select>

 

<!-- this menu holds the files to go-->

 

<select name="menuFilesDMA" style="width:300">

 

<option value="none"> Choose Country

</select> </td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"><span class="style58">

<font color="#000000">(20 character limit)</font></span></td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF">

<span class="style58"><font color="#00518D"><em>i.e.</em>where and when did the events you have written about occur? </font></span></td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">6</font></span><span class="style62"><font color="#EE7F01">. </font> P<span class="style78">hotos:</span></span></td>

<td bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" bgcolor="#FFFFFF"><label>

<input name="userfile" type="file" id="userfile">

</label></td>

</tr>

<tr>

<td bgcolor="#FFFFFF"> </td>

<td bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" bgcolor="#FFFFFF"> </td>

</tr>

 

<tr>

<td width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td width="546" height="42" bgcolor="#FFFFFF"><span class="style68">

<font color="#EE7F01">7</font></span><span class="style62"><font color="#EE7F01">. </font>C<span class="style78">atagory:</span></span></td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="middle" width="546" bgcolor="#FFFFFF"><select name="Catagory" id="Catagory">

                            <option>Magazine</option>

                            <option>News</option>

                            <option>Review</option>

                            <option>List</option>

                          </select></td>

</tr>

<tr>

<td width="546" bgcolor="#FFFFFF"> </td>

<td width="546" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">

<span class="style18">

<a href="catagories.html"><font color="#00518D">Choose the c</font></a></span><span class="style10"><a href="catagories.html"><font color="#00518D">atagory that best suits your article (if unsure click here)</font></a></span> </td>

</tr>

<tr>

<td width="546" height="19" bgcolor="#FFFFFF"> </td>

<td width="546" height="19" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="19" bgcolor="#FFFFFF"> </td>

</tr>

<tr>

<td width="546" height="19" bgcolor="#FFFFFF"> </td>

<td width="546" height="19" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="19" bgcolor="#FFFFFF"> 

</td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"><font color="#EE7F01">

<span class="style68">8.</span> </font>

<span class="style62">S<span class="style78">ubmit:</span></span></td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF"><span class="style51">By submitting you agree to the <span class="style17"> <a href="register.html"><font color="#00518D">terms of use</font></a></span> and <span class="style17"><a href="register.html"><font color="#00518D">privacy policy</font></a></span>.</span></td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">  </td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF"><label>

<INPUT type=submit value=Submit name=submit>

</label></td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">  </td>

</tr>

<tr>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td width="546" height="20" bgcolor="#FFFFFF"> </td>

<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">

<span class="style51">Having problems with a submission? Email

<a href="mailto:info@mysite.com">

info@mysite.com</a>.</span></td>

</tr>

<tr>

<td width="14" height="28" background="line_left_corner.png" bgcolor="#FFFFFF"> </td>

<td height="28" width="546" background="line_base.png" colspan="3" bgcolor="#FFFFFF"> </td>

<td width="14" height="28" background="line_right_corner.png" bgcolor="#FFFFFF"> </td>

</tr>

</table>

</td>

<td width="14"> </td>

</tr>

<tr>

 

<td width="574"> </td>

<td width="14"> </td>

</tr>

</table></form>

 

 

Any help is much appriciated,

 

Colin

Link to comment
https://forums.phpfreaks.com/topic/67891-problem-uploading-files-to-databases/
Share on other sites

Don't "upload" files to a database.  Upload them to a server, and put there path information in a database.

 

Hi, thanks for the reply, i was just wondering if anyone can point me towards a script that could upload a file to a sever and write a path to a mysql database. The ones that I have tried in the past have not worked.

 

Thanks

Colin

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.