Can you help me find the mistake? I received help with my request for help in a posting:
“I have this code, for an Upload Form, that works successfully renaming and moving an uploaded file to the uploads/ folder. If an image isn’t uploaded, how can I put a default file where the file would have been if it were uploaded?”.
I’m no longer asking for help with a “default file”, but am asking for help with the reply/help where I was given coding assistance that didn’t work successfully and was told “I did make a mistake - look at the arguments of copy and move_uploaded_file to find it” See: How to add a default file - #7 by Michael_Morris
for more info.
Anyway, I tried several things to correct the mistake, without success. Can someone help me, please, correct the mistake in this code:
This was my mistake: when assembling the $thumbnail string I copied your code and didn’t notice you where prepending ‘uploads’ in your move_uploaded_file call. This prepending must also be applied to the copy call.
Or you need to apply the prepending when the rest of the thumbnail string is applied.
Like most experienced programmers I assumed that all operations that were to be applied to thumbnail were being done before the function call. If I paid more attention I would have caught it.
.if (!in_array($extension,$allowedExts) || empty($_FILES[“file”][“name”]))
{
EDIT: OK, I see why you had it like you have it. Just didn’t look right at first. Moderator can remove this post.