Jump to content

rename file extention in move_uploaded_file


timmyd

Recommended Posts

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

 

 

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.