Jump to content

upload image to just one folder


$php_mysql$

Recommended Posts

hey guys my this current code would upload a image to directory1 then it would resize and send it to dierctory2 which is the image_thumbs folder and then delete the original image from the directory1

 

global $uploadPath;
		$imagepath = uploadFile($_FILES['image'], $uploadPath);
		// code to resize and save the original image
		$image = new SimpleImage();
		$image->load($imagepath);
		$image->resize(204,250);
		$thumb_path = 'image_thumbs/thumb_'.$_FILES['image']['name'];
		$image->save($thumb_path);
		//image resize end

		unlink($imagepath); //delete the original file

 

how can i remove the $thumb_path and do everything in just $uploadPath which is directory1

Link to comment
https://forums.phpfreaks.com/topic/243794-upload-image-to-just-one-folder/
Share on other sites

try this:

global $uploadPath;
		$imagepath = uploadFile($_FILES['image'], $uploadPath);
		// code to resize and save the original image
		$image = new SimpleImage();
		$image->load($imagepath);
		$image->resize(204,250);
		$image->save($imagepath); // Removed $thumb_path, replaced save($thumb_path) with $imagepath
		//image resize end

		unlink($imagepath); //delete the original file

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.