npsari Posted October 29, 2011 Share Posted October 29, 2011 If I upload this script in /www/ads/insert/image/ it works fine If I upload it in /www/ads/insert/ it does not work It says PHP could not open /new/ to upload image <? $target_path = 'images/new/'; $image_name = 'myself.gif'; if( imagejpeg( $tmp_img, "{$target_path}{$image_name}" ) ){ print"image uploaded!"; } ?> I think because PHP only allows to upload images 1 folder deep!!! Why? How do I solve this? I want to create different folders for each group of images Quote Link to comment https://forums.phpfreaks.com/topic/250064-script-must-be-in-same-folder-as-image/ Share on other sites More sharing options...
AyKay47 Posted October 29, 2011 Share Posted October 29, 2011 is there an "images" directory in the "insert" directory? as opposed to the "image" directory Quote Link to comment https://forums.phpfreaks.com/topic/250064-script-must-be-in-same-folder-as-image/#findComment-1283321 Share on other sites More sharing options...
npsari Posted October 29, 2011 Author Share Posted October 29, 2011 Hello Sorry, what I meant is, do I have to upload the php script in same directory where the image will be uploaded Because when i ask the script to upload the image 2 directories deep, it does not work Quote Link to comment https://forums.phpfreaks.com/topic/250064-script-must-be-in-same-folder-as-image/#findComment-1283335 Share on other sites More sharing options...
jcbones Posted October 29, 2011 Share Posted October 29, 2011 No, php doesn't care were you move the file to, just so long as it is a directory with write permissions, and you supply a valid path to it. Quote Link to comment https://forums.phpfreaks.com/topic/250064-script-must-be-in-same-folder-as-image/#findComment-1283336 Share on other sites More sharing options...
AyKay47 Posted October 30, 2011 Share Posted October 30, 2011 yeah, I'm getting the feeling that this is a path issue.. make sure the target path from your page directory exists before execution.. Quote Link to comment https://forums.phpfreaks.com/topic/250064-script-must-be-in-same-folder-as-image/#findComment-1283351 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.