timmyd Posted December 4, 2007 Share Posted December 4, 2007 HI i have a problem, i want to upload a file in a different format and at the same time create a thumbnail. Everything is working so far except when i upload a .GIF file. If i upload a .gif file it will be uploaded as .jpg which is good. but the extension remains .gif. How can i rename the extention for this: <? if(move_uploaded_file($_FILES[$form_field]['tmp_name'][$p], $store_pad.$file)) ?> cheerz Link to comment https://forums.phpfreaks.com/topic/80117-rename-file-extention-in-move_uploaded_file/ Share on other sites More sharing options...
adam291086 Posted December 4, 2007 Share Posted December 4, 2007 ok i am not a guru at this but couldn't you just explode from the . that seperates the file names and file type. Then just replace the .gif with .jpeg $file //variable for the uploaded file $type = explode(".", $file); echo $type[0]; // name echo $type[1]; // file type There maybe a better way to do this but this could be an idea Link to comment https://forums.phpfreaks.com/topic/80117-rename-file-extention-in-move_uploaded_file/#findComment-405990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.