So I am making a class which handles my file uploading from a form. The problem I am having is during renaming the file from the temporary one, to the new one. My class gives the user the ability to manually specify the filename, or use the same name it was uploaded as. Now, If I manually set the name, I need to be able to know the extension to add to the file. Since the temp folder does not include extensions, and I would prefer not to explode it at the period from $file['uploadedfile']['name'], what would one suggest I do?
I guess my initial question would be: Is there any way to configure the server/php so it does not rename the file when it is placed in the temp folder, so I can use pathinfo() for the extension.
No.
Use the original extension, either the typed one or the one in
$_FILES[x]['name']. What’s wrong with that?