I have written code to upload and resize images. There are two files, index.php (for the form) and upload.php (for the backend processing).index.php\[code\]<form action="image-crop-demo.php" method="post" enctype="multipart/form-data"> Upload an image for processing<br> <input type="file" name="fupload"><br> <input type="submit" value="http://stackoverflow.com/questions/12792544/Upload"></form>\[/code\]upload.php\[code\]<?php$lokasi_file = $_FILES['fupload']['tmp_name'];$tipe_file = $_FILES['fupload']['type'];$nama_file = $_FILES['fupload']['name'];$acak = rand(1,99);$nama_file_unik = $acak.$nama_file; $vfile_upload = $vdir_upload . $nama_file_unik;$vdir_upload = "../gallery";define('DESIRED_IMAGE_WIDTH', 150);define('DESIRED_IMAGE_HEIGHT', 150);$source_path = $lokasi_file;list($source_width, $source_height, $source_type) = getimagesize($source_path);$source_gdim = imagecreatefromjpeg($source_path);$source_aspect_ratio = $source_width / $source_height;$desired_aspect_ratio = DESIRED_IMAGE_WIDTH / DESIRED_IMAGE_HEIGHT;if ($source_aspect_ratio > $desired_aspect_ratio) { /*Jika gambar lebih lebar*/ $temp_height = DESIRED_IMAGE_HEIGHT; $temp_width = ( int ) (DESIRED_IMAGE_HEIGHT * $source_aspect_ratio);} else { /*jika gambar sama atau lebih tinggi*/ $temp_width = DESIRED_IMAGE_WIDTH; $temp_height = ( int ) (DESIRED_IMAGE_WIDTH / $source_aspect_ratio);}/*Resize the image into a temporary GD image*/$temp_gdim = imagecreatetruecolor($temp_width, $temp_height);imagecopyresampled($temp_gdim,$source_gdim,0, 0,0, 0,$temp_width, $temp_height,$source_width, $source_height);/*Copy cropped region from temporary image into the desired GD image*/$x0 = ($temp_width - DESIRED_IMAGE_WIDTH) / 2;$y0 = ($temp_height - DESIRED_IMAGE_HEIGHT) / 2;$desired_gdim = imagecreatetruecolor(DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT);imagecopy($desired_gdim,$temp_gdim,0, 0,$x0, $y0,DESIRED_IMAGE_WIDTH, DESIRED_IMAGE_HEIGHT);imagejpeg($desired_gdim,$vdir_upload . "small-" . $nama_file_unik);?>\[/code\]The problem is in the upload.php. I want to make the code resize image, save into a gallery directory on the server with a random name and the prefix "small". If the code worked it would save the image into the gallery directory with a filename similar to "small-14test.jpg".Thanks in advance!