Jump to content

mkdir() will not work on windows system


acjetnut

Recommended Posts

I am writing a very simple upload script that works beautifully on my *nix server.  However, when I gave it to the person I wrote it for, I discovered that he uses a windows machine and it no longer works.  I think the issue comes down to "mkdir()", as I have done extensive testing with it and even simple calls of the code will not work.  Folder permissions are all "777".

 

Anyone have any ideas?

 

 

Code:

 

<?php

//get timestamp and make directory in ads folder
$timestamp = time();
mkdir("./ads/$timestamp") or die ("Could not make directory");


//define path that will store file
$target = "./ads/$timestamp/";
$target = $target . basename($_FILES['uploadedfile']['name']);


//create text file that stores text form fields
$infoText = "./ads/$timestamp/info.txt";
$fileHandle = fopen($infoText, 'w') or die("can't open file");
fwrite($fileHandle, $_POST['info']);
fclose($fileHandle);


//move file to storage path
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target))
{
echo "The file " . basename($_FILES['uploadedfile']['name']) . " has been uploaded.";
}
else
{
echo "There was an error uploading the file, please try again!";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/69252-mkdir-will-not-work-on-windows-system/
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.