Jump to content

Image Upload


tobimichigan

Recommended Posts

Hey, I want to say a big thank you to you guys for ya help, even though I once slipped a correction. Please I want to upload image from a registration page. I already have this:

$amountd = addslashes($_POST['amountd']);
$department=addslashes($_POST['department']);
$email=addslashes($_POST['email']);
$fname =addslashes($_POST['fname']);
$ledgerno =addslashes($_POST['ledgerno']);
$lga=addslashes($_POST['lga']);
$lname=addslashes($_POST['lname']);
$nationalty=addslashes($_POST['Nationalty']);
$oname=addslashes($_POST['oname']);
$pfno=addslashes($_POST['pfno']);
$residentialadd=addslashes($_POST['residentialadd']);
$sex=addslashes($_POST['sex']);
$soorigin=addslashes($_POST['soorigin']);
$regdate= date("Ymd H:i:s");			


$sql= "Insert into user_table(amountd,department,email,fname,ledgerno,lga,lname,Nationalty,oname,pfno,residentialadd,sex,soorigin,regdate) values('$amountd','$department','$email','$fname','$ledgerno','$lga','$lname','$nationalty','$oname','$pfno','$residentialadd','$sex','$soorigin','$regdate')";  
	                            
if (!mysql_query($sql))
{
  die('Error: ' . mysql_error()."  SQL: ".$sql);
  }
echo ("1 record added");
?>

 

How do I include an image file into the user table alongside the other parameters?

 

Thanks a mil....

Link to comment
https://forums.phpfreaks.com/topic/158165-image-upload/
Share on other sites

Instead of allowing members to upload their images... why not allow them to enter the url for the image... then simply display the url as a image.

Databases aren't designed to store image files, you'd be better off to upload that file to a dropbox area and then record it's location to the database.

 

Url seany? They are registering for the 1st time and have no idea what urls r. I want to enable them  to upload straight from the registration page. Otherwise, after registration they can do so to their personal pages.

 

DyslexicDog, please could you elaborate on your process?

Link to comment
https://forums.phpfreaks.com/topic/158165-image-upload/#findComment-834302
Share on other sites

basically, what they're trying to say is to have the user upload their image to a folder on the server, and have the image filename stored in the database .. then, anytime the image is to be display, you just point to the image in the folder on the server.

Create a file upload system that drops the file to a upload inbox on your server. Then record the file location to the database.

 

mrMarcus, & DyslexicDog please I'd appreciate it if can just demostrate how 2 do this from the snipplet below.

 


<?php$amountd = addslashes($_POST['amountd']);
$department=addslashes($_POST['department']);
$email=addslashes($_POST['email']);
$fname =addslashes($_POST['fname']);
$ledgerno =addslashes($_POST['ledgerno']);
$lga=addslashes($_POST['lga']);
$lname=addslashes($_POST['lname']);
$nationalty=addslashes($_POST['Nationalty']);
$oname=addslashes($_POST['oname']);
$pfno=addslashes($_POST['pfno']);
$residentialadd=addslashes($_POST['residentialadd']);
$sex=addslashes($_POST['sex']);
$soorigin=addslashes($_POST['soorigin']);
$regdate= date("Ymd H:i:s");         
         

$sql= "Insert into user_table(amountd,department,email,fname,ledgerno,lga,lname,Nationalty,oname,pfno,residentialadd,sex,soorigin,regdate) values('$amountd','$department','$email','$fname','$ledgerno','$lga','$lname','$nationalty','$oname','$pfno','$residentialadd','$sex','$soorigin','$regdate')"; 
                                 
if (!mysql_query($sql))
{
  die('Error: ' . mysql_error()."  SQL: ".$sql);
  }
echo ("1 record added");
?>

Link to comment
https://forums.phpfreaks.com/topic/158165-image-upload/#findComment-834637
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.