atholon Posted January 2, 2008 Share Posted January 2, 2008 ...well they all are since I am a nOOb Anyway, I am trying to make a script that is located in a directory like www/includes/file and I need it to create a directory in this other directory located at www/uploads/video. I know that conventionally you use mkdir("../uploads/$iSection/$iNumber"); and that takes it back to the root www then into uploads and video but for some reason it is not working. It gives me this message: Warning: mkdir(../uploads/video/28): No such file or directory in c:\easyphp\www\includes\global_functions.php on line 174 Warning: move_uploaded_file(../uploads/video/28/review_1199351356.gif): failed to open stream: No such file or directory in c:\easyphp\www\includes\global_functions.php on line 175 Warning: move_uploaded_file(): Unable to move 'C:/EasyPHP\tmp\php6.tmp' to '../uploads/video/28/review_1199351356.gif' in c:\easyphp\www\includes\global_functions.php on line 175 function upload($iFile, $iSection, $iNumber) { $curFileSize = isset($iFile["size"]) ? (int)$iFile["size"]: 0; if( $curFileSize > 0 ) { $tmp_name = $iFile["tmp_name"]; $name = strtolower($iFile["name"]); echo ("<br>File Name:$name<br>"); $ext = substr(strrchr($name, "."), 1); echo ("<br>File Extention:$ext<br>"); $randomfile = time()+rand(0,1000000); $name = "review_{$randomfile}.{$ext}"; $actualfilelocation = "../uploads/$iSection/$iNumber/$name"; while (file_exists($actualfilelocation)) { $randomfile = time()+rand(0,1000000); } mkdir("../uploads/$iSection/$iNumber"); move_uploaded_file($tmp_name, "../uploads/$iSection/$iNumber/$name"); } } Quote Link to comment https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/ Share on other sites More sharing options...
atholon Posted January 3, 2008 Author Share Posted January 3, 2008 Guess it isn`t that easy Quote Link to comment https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/#findComment-428813 Share on other sites More sharing options...
neilfurry Posted January 3, 2008 Share Posted January 3, 2008 I think this is an invalid directory issue, i've also encountered this error before, and all i did was to set the exact path to the upload directory/folder. :-) Quote Link to comment https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/#findComment-428818 Share on other sites More sharing options...
atholon Posted January 3, 2008 Author Share Posted January 3, 2008 Seems to have worked but it is giving me the same crap about including a config file in the root directory. I have never seen it this picky. THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/#findComment-428846 Share on other sites More sharing options...
atholon Posted January 3, 2008 Author Share Posted January 3, 2008 Hhehehe I am a moron. It wouldn`t work because I was referring to the directory for the globalfunction's directory when I should have referred to the directory of the file that was including it. Quote Link to comment https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/#findComment-429556 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.