having error in uploading photo

Started on the old forum in May 2009 · view the original in the archive · old links redirect here

2 replies · 354 views · started 17 years ago · 1 min read

2 participants
bijaybd Developer · 178 posts #1

i am having a problem with photo uploading - here is the code

$photo_type = substr($_FILES['photo']['type'], 6);
$sql = mysql_query("UPDATE `chat_users` SET `photo` = '".$photo_type."' WHERE `id` = '".$id."';");
    if(copy($_FILES['photo']['tmp_name'], "photos/".$id.".".$photo_type.""))
    {
    echo "Photo Uploaded Successfully<br/>";

everything goes ok as like as photo copied in the photos folder including all the other things.

but in sql chat users in photo field it only update the type of the photo for example gif or jpeg it won't update the full url like for example coding-talk.com/photos/1.gif?23232

can somebody help me !

Anshul Senior · 296 posts #2

bijaybd wrote: i am having a problem with photo uploading - here is the code

$photo_type = substr($_FILES['photo']['type'], 6);
$sql = mysql_query("UPDATE `chat_users` SET `photo` = '".$photo_type."' WHERE `id` = '".$id."';");
    if(copy($_FILES['photo']['tmp_name'], "photos/".$id.".".$photo_type.""))
    {
    echo "Photo Uploaded Successfully<br/>";

everything goes ok as like as photo copied in the photos folder including all the other things.

but in sql chat users in photo field it only update the type of the photo for example gif or jpeg it won't update the full url like for example coding-talk.com/photos/1.gif?23232

can somebody help me !

$sql = mysql_query("UPDATE `chat_users` SET `photo` = 'photos/".$id.".".$photo_type."' WHERE `id` = '".$id."';");
bijaybd Developer · 178 posts #3

hey thanks bro its working fine many many thanks to you for the great help !

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close