buddhi225 Posted May 31, 2009 Share Posted May 31, 2009 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! Link to comment https://forums.phpfreaks.com/topic/160354-need-help-sending-uploaded-files-to-a-subfolder/ Share on other sites More sharing options...
anupamsaha Posted May 31, 2009 Share Posted May 31, 2009 Try this: move_uploaded_file($paperTMP, $_SEVER['DOCUMENT_ROOT'].'/'.$folder.'/'.$paper); Link to comment https://forums.phpfreaks.com/topic/160354-need-help-sending-uploaded-files-to-a-subfolder/#findComment-846242 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.