There is nothing wrong with the code it is simply how it is done. There is no temp file. We throw the uploaded file into the uploads directory and then process those pictures and they are moved into the data folder. Your calling getimagesize in create_thumb against the $filepath variable. Filepath is simply the users uploads directory and filename. You need to actually call getimagesize against an actual true file to get info from this is how it works.