Casalen Posted June 26, 2007 Share Posted June 26, 2007 I would like to create a text file containing order information. I'll spare you the rest of the code, but the script creates a directory where people can upload images. With each upload the information of the filename and order is put into two variables, $order_text and $order_table, the first for my text file, the second for display. My goal is to then write to the text file that I made after creating the directory. Unfortunately, fopen is giving me 'file does not exist' errors. The file doesn't exist, but I'm using modes that are supposed to create a file if it isn't found. $handle = fopen("./sales/$num/order.txt", "w"); And w+, x, x+, etc. And yes, the directory is chmodded so it's not a permission problem. Help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 26, 2007 Share Posted June 26, 2007 Some more code would be appreciated. Just post the whole script, the error line number and which line that is. It will make it alot easier for us since it's hard to guess what "I'm using modes that are supposed to create a file if it isn't found" is exactly Quote Link to comment Share on other sites More sharing options...
Casalen Posted June 26, 2007 Author Share Posted June 26, 2007 By that I'm referring to the 'w', etc. Sorry I wasn't much more detailed, but my eyes were glazing over at that point. Here is the first part of the script, right up to the first error message- could not open file. The second error message is that it couldn't write to the unopened file, but this is the part that causes me issues. It decides what number is up next for the client's images, $dird tells me if it finished or not. As you can see, the fopen uses the same type of path as the mkdir, which should make it work pretty simply. <? $num = 1; $dird = 1; if($dird == 1){ echo "";} while($dird == 1){ echo ""; $filename = "http://www.kgpphoto.com/sales/$num"; if(!is_dir("./sales/$num")){ mkdir("./sales/$num"); chmod("./sales/$num", 0777); $path = "./sales/$num/"; $dird = 2; } $num++; } $handle = fopen("./sales/$num/order.txt", "w"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.