$php_mysql$ Posted August 4, 2011 Share Posted August 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/243794-upload-image-to-just-one-folder/ Share on other sites More sharing options...
MasterACE14 Posted August 4, 2011 Share Posted August 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/243794-upload-image-to-just-one-folder/#findComment-1251780 Share on other sites More sharing options...
AyKay47 Posted August 4, 2011 Share Posted August 4, 2011 i recommend that you avoid using globals...food for thought http://blog.case.edu/gps10/2006/07/22/why_global_variables_in_php_is_bad_programming_practice Quote Link to comment https://forums.phpfreaks.com/topic/243794-upload-image-to-just-one-folder/#findComment-1251782 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.