# Resize image when uploading

**URL:** <https://forum.kirupa.com/t/resize-image-when-uploading/248495>\
**Category:** programming\
**Created:** [January 8, 2008, 8:39pm UTC](https://forum.kirupa.com/t/resize-image-when-uploading/248495 "2008-01-08T20:39:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rocketrud](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@Rocketrud](https://forum.kirupa.com/u/Rocketrud)\
**Post date:** [January 8, 2008, 8:39pm UTC](https://forum.kirupa.com/t/resize-image-when-uploading/248495/1 "2008-01-08T20:39:16Z")

</div>

This is my code:

```
&lt;?php 

```

$target = “text/theatre”;  
$target = $target . basename( $\_FILES[‘uploaded’][‘name’]) ;  
$ok=1;  
if(move\_uploaded\_file($\_FILES[‘uploaded’][‘tmp\_name’], $target))  
{  
echo "The file “. basename( $\_FILES[‘uploadedfile’][‘name’]). " has been uploaded”;  
}  
else {  
echo “Sorry, there was a problem uploading your file.”;  
}  
?\>

I would like to have the image resized to 360 X 300 upon upload. Could somebody please modify this code and repost it?
