Can't create folders on UNIX
Posted: Mon Mar 03, 2008 5:37 pm
I've utilized a little "uploading java applet" that I found on the web which allows you to upload files to a server by drag and drop. The java applet calls a pretty straight forward upload script which basically creates a folder and saves the uploaded file in that folder. The app. works wonders when I run it locally on my Windows machine - but when I deploy it with on my Unix server (shared hosting) it just doesn't work. It doesn't create the folders nor does it save the file. What is ever weirder is that the PHP script doesn't throw an error. And the mkdir comes back as "true" when I try to debug....
I'm obviously thinking this issue has to do with "A" the development environment and "B" php.ini settings - having said that, I don't have a clue what exactly the problem is...I've included some of the code I'm using below:
If anyone could give me a hint as to to what the problem might be I would be very, very thankful.
Cheers,
Mikael
I'm obviously thinking this issue has to do with "A" the development environment and "B" php.ini settings - having said that, I don't have a clue what exactly the problem is...I've included some of the code I'm using below:
Code: Select all
$subfolder = $_GET['placement_id'];
$campaign = $_GET['campaign_id'];
$root = '_files';
//create new campaign folder if it doesn't already exist
if(!is_dir ($root.'/'.$campaign)){
mkdir("$root/$campaign", 0777);
}
//create new subfolder (for the placement) if it doesn't already exist
if(!is_dir ($root.'/'.$campaign.'/'.$subfolder)){
mkdir("$root/$campaign/$subfolder", 0777);
}
$save_path = $root.'/'.$campaign.'/'.$subfolder.'/';
$file = $_FILES['userfile'];
$k = count($file['name']);
for($i=0 ; $i < $k ; $i++)
{
if($i %2)
{
echo '<tr bgcolor="#FFFF99"> ';
}
else
{
echo '<tr>';
}
echo '<td align="left">' . $file['name'][$i] ."</td>\n";
echo '<td align="right">' . $file['size'][$i] ."</td></tr>\n";
if(isset($save_path) && $save_path!="") {
$name = split('/',$file['name'][$i]);
move_uploaded_file($file['tmp_name'][$i], $save_path . $name[count($name)-1]);
}
}
echo "<tr style='color: #0066cc'><td>SSL</td><td>". (($_SERVER[HTTPS] != 'on') ? 'Off' : 'On') ."</td></tr>";
if(! isset($save_path) || $save_path =="")
{
echo '<tr style="color: #0066cc"><td colspan=2 align="left">Files have not been saved, please edit upload.php to match your configuration</td></tr>';
}If anyone could give me a hint as to to what the problem might be I would be very, very thankful.
Cheers,
Mikael