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

 

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.