Jump to content

Images Uploading/Displaying


dfowler

Recommended Posts

Hey everybody.  This is a two part question.  I have never actually had to deal with this before, and I have read through several topics about this here.  It seems consensus for the best option when dealing with images is to save them on the server, then have the file location in the database.  Here is what I am trying to do.

 

Upload

A user can create a record that includes a name and a description about themselves then has the option to upload an image.  Then when they submit the image is uploaded and kept in a directory while the image location is uploaded (along with the name and description) to a database. (I have the form created right now minus the image part):

<form action="addM2.php" method="POST">
<table>
<tr>
	<td>Name: <input type="text" name="name" /></td>
</tr>
<tr>
	<td>Description</td>
</tr>

<tr>
	<td><textarea name="description"></textarea></td>
</tr>
<tr>
	<td><input type="submit" value="Submit" /><input type="reset" value="Clear" /></td>
</tr>
</table></form>

<?php
include '../system.php';

$name = $_POST['name'];
$description = $_POST['description'];

$SQL = "INSERT INTO table set name='$name', description='$description'";

mysql_query($SQL);

print "Meal successfully added!";
?>

 

Display

To display everything I want a page where the name (in a checkbox) and a thumbnail of the image are pulled dynamically and displayed.  This will give a user the option to pick who they want to hear more about.  However, if there are no images it still displays all the names (in checkboxes).  Once again, minus the image part I think I can do this.  Any help would be greatly appreciated.

Link to comment
Share on other sites

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.