PHP follows almost same way of writing and manipulating files as in standard C. That is why it becomes so easy for a developer with C language background to create php application that uses files to save and retrieve data. It is a short tutorial that will get you started with writing and manipulating text files.
To open a file either for writing, manipulating (adding new data, or appending new data at end of file), we use single function called fopen, but the second argument of the function changes accordingly.
$F = fopen("myfile.txt","w");
Here the second argument passed was "w" only, which means write the file, if it does not exists then create it, and if does not exist create new file.
There is a traditional way of uploading files in php usually developers use, that is, use functions is_uploaded_file() and move_uplaoded_file(). These functions my create problems sometimes. function move_uplaoded_file() sometimes does not let you move file to a specific folder, may be becuase your account does not have permission to move a temporary file to some folder in your account. I encountered same problem when my client reported me that he has ful permissions to write a file anywhere in any folder, and he has successfully chmod-ed the folders to 777 / 666 (on unix server), but he still cannot get the admin panel script to perform uploading of image.
Clixint Technologies. is a registered international firm focused on conceiving, developing and distributing customer-focused IT solutions for the large as well as small to mid-sized businesses that are serious about excelling and achieving success. We provide conceptual, functional and presentational development for the global business community through out-of-the-box web strategy, design and technology solutions. We have been delivering quality products since 2002.