lifeson2112 Posted March 13, 2007 Share Posted March 13, 2007 Hello, I have been trying to make a page to upload files to my server, but I can't seem to get it to work. <html> <form name="submit_file" action="getFile.php" method="post" encytype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="2000"> <input type ="file" name="tab_file" id="tab_file"/> <input type="submit" value="submit file" /> </form> </html> <?php if (is_uploaded_file($HTTP_POST_FILES['tab_file']['tmp_name'])) { echo "File was uploaded to temporary directory.\n"; } else { echo "This is not working!!!!!!\n"; //line 21 below if(unlink($HTTP_POST_FILES['tab_file']['tmp_name'])) echo"deleted crappy file"; } ?> Also, ever since I put the "unlink" function in there it gives me this error - Warning: unlink() [function.unlink]: Permission denied in C:\Program Files\xampp\htdocs\getFile.php on line 21 From this, I'm pretty sure my server isn't even storing the file in a temporary directory or doesn't know where to get it. ? Any help on this at all would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/42542-help-with-uploading-to-server/ Share on other sites More sharing options...
papaface Posted March 13, 2007 Share Posted March 13, 2007 Use $_POST instead of $HTTP_POST_FILES There isnt really a reason why you need to delete the temp file, it will get deleted eventually anyway. Also I dont think you can delete the files in the /tmp directory on your server. Link to comment https://forums.phpfreaks.com/topic/42542-help-with-uploading-to-server/#findComment-206395 Share on other sites More sharing options...
lifeson2112 Posted March 13, 2007 Author Share Posted March 13, 2007 I tried using $_POST, but that doesn't seem to work. I also tried $_FILE... Think it might be a problem with how my server stores the temporary files? Link to comment https://forums.phpfreaks.com/topic/42542-help-with-uploading-to-server/#findComment-206411 Share on other sites More sharing options...
papaface Posted March 13, 2007 Share Posted March 13, 2007 Why do you want to delete the temp file ??? It gets deleted every 30 mins or so automatically by your host.... Link to comment https://forums.phpfreaks.com/topic/42542-help-with-uploading-to-server/#findComment-206416 Share on other sites More sharing options...
lifeson2112 Posted March 13, 2007 Author Share Posted March 13, 2007 yeah, I'm not so worried about deleting the file i guess. I'm worried that the server couldn't find the file to delete. Could this mean my server is storing temporary files where the php can't find it? Link to comment https://forums.phpfreaks.com/topic/42542-help-with-uploading-to-server/#findComment-206551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.