Jump to content

[SOLVED] SIMPLE QUESTION FOR ONCE


atholon

Recommended Posts

...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");
  }
}

Link to comment
https://forums.phpfreaks.com/topic/84194-solved-simple-question-for-once/
Share on other sites

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.