moviedrome Posted April 22, 2007 Share Posted April 22, 2007 Hi, I have this code $uploaddir = dirname($_SERVER['SCRIPT_FILENAME']) ."/Images/"; and it uploads the image to /admin/images/ as the page i'm running it from is in the admin directory. I've tried just using the http:// and it doesn't like it. Could someone please tell me how i can make it upload the image to /images/ instead of within the admin folder. Thanks Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/ Share on other sites More sharing options...
Mutley Posted April 22, 2007 Share Posted April 22, 2007 Try: $uploaddir = dirname($_SERVER['SCRIPT_FILENAME']) ."../Images/"; Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235567 Share on other sites More sharing options...
moviedrome Posted April 22, 2007 Author Share Posted April 22, 2007 URGH, Got this nasty error: Warning: move_uploaded_file(/home/moviedro/public_html/hdtv/admin../Images/20070422174447_20050808203909_c5_1_b.JPG) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/moviedro/public_html/hdtv/admin/admin.rewards.add.php on line 58 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phphV2p2M' to '/home/moviedro/public_html/hdtv/admin../Images/20070422174447_20050808203909_c5_1_b.JPG' in /home/moviedro/public_html/hdtv/admin/admin.rewards.add.php on line 58 Column 'image' cannot be null Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235570 Share on other sites More sharing options...
arianhojat Posted April 22, 2007 Share Posted April 22, 2007 try $uploaddir = dirname($_SERVER['SCRIPT_FILENAME']) ."/../Images/"; maybe Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235575 Share on other sites More sharing options...
Mutley Posted April 22, 2007 Share Posted April 22, 2007 Try just: $uploaddir = '../images/'; Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235577 Share on other sites More sharing options...
moviedrome Posted April 22, 2007 Author Share Posted April 22, 2007 hmm, ok that works. Thanks, however it's uploading it to the main www. instead of my new subdomain. I think it's probably stored within this bit dirname($_SERVER['SCRIPT_FILENAME']) but i'm a bit clueless as to where this is looking for the info? Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235579 Share on other sites More sharing options...
Mutley Posted April 22, 2007 Share Posted April 22, 2007 I'm guessing your subdomain is in the /hdtv/ folder? So try: $uploaddir = '../hdtv/images/'; Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235584 Share on other sites More sharing options...
moviedrome Posted April 22, 2007 Author Share Posted April 22, 2007 Sorry, same error as before. I'm guessing that it gets the www. from the script filename. Where would this be stored? Thanks Richard Link to comment https://forums.phpfreaks.com/topic/48190-upload-folder-is-not-right/#findComment-235589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.