PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
what i want to do is to see if a picture was sent in the form. If the picture was sent, I capture the name of the picture, if no picture was sent, then I want to add to db the "no_picture.gif"
can I do that? how?
pls help
thx
thx 4 the urgently help
now I have another problem.
if the file is set it enters the name in the db, but if the file isn't set, it doesn't inserts the "no_picture.gif"
why?
Set up the conditions for getting no_picture.gif and then print the variable to the screen to see if your getting the result you want. This will help to determine where the variable is getting lost. You might also try replacing isset() with !empty() and see what happens....
What I think is happening is that the $_Files array is not getting "unset", so that if I try to use the same script/page it thinks the the $_Files array is set even though not from the last post.
So, my !empty() is reading as, well, !empty, when it should be.
How do I "unset" $_Files arrays? so that I can continue to use the same script/page for multiple records?
Here's the whole block that's supposed to do the file move and add the name to a table on the condition that there's something to do. Right now it puts "" in the table if noone sets the file form box, essentially wiping out what was previously there.
if (!empty ($_FILESї'logo'])){
move_uploaded_file($_FILESї'logo']ї'tmp_name'], $imagefile);
$updateFile = sprintf("UPDATE teams SET logo=%s WHERE team_id=%s",
GetSQLValueString($_FILESї'logo']ї'name'], "text"),
GetSQLValueString($_POSTї'team_id'], "int"));
mysql_select_db($database_euro, $euro);
$Result2 = mysql_query($updateFile, $euro) or die(mysql_error());
the $_FILES['logo'] will never be empty.. it just won't contain file information. You may want to look at the error code, or see if the temporary name is empty instead.