Jump to content

Need help sending uploaded files to a subfolder


buddhi225

Recommended Posts

Hi so GoDaddy needs me to give my folder permissions to accept files so I needed to create a subfolder in my directory: papers. Here is my code for uploading files, where do I add that it needs to go into the papers folder first?

 

$paperTMP= $_FILES['paper']['tmp_name'];
if(is_uploaded_file($paperTMP)){
if($_FILES['paper']['type']== "application/msword"){
//creating folder
while (1){
$folder= rand(1000,1000000);
$result= mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `jobs` WHERE `folder` = $folder"));
if ($result[0] == 0) {
break;
}
}
mkdir($folder);
chmod($folder, octdec('0666'));
$paper= $_FILES['paper']['name'];
move_uploaded_file($paperTMP,$folder."/".$paper);

 

Thanks for your help!

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.