Jump to content

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

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.