Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.