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!
I have this code to take care of my files I upload on my server. But sometimes files get skipped and won't upload. How can I in that case retry the script to give the file a new shot?
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], "../media/uploads/". $myVariable. ".jpg")){
// do somethine
} else {
move_uploaded_file($_FILES['Filedata']['tmp_name'], "../media/uploads/". $myVariable. ".jpg"); // Second attempt
}
Obviously you could put this into a loop but then you'd need to ensure you don't get stuck in an infinite loop when something goes wrong (like when the users file is too large)