Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


opening files

Posted on 2006-04-21
Medium Priority
Last Modified: 2010-04-06
For record...

if (!($f=fopen("welcome.txt","r")))
exit("Unable to open file!");

Can I open a file to read or write or read and write with an error message for a not opened file and without ")))"?

For record...

   "Unable to open file!"

Can I open a file the way I wrote?
Question by:locke2005
1 Comment

Accepted Solution

AndyAelbrecht earned 80 total points
ID: 16518892
$fp = fopen("welcome.txt,"r") or die("Unable to open file!"); //checks for read access, dies if not able to open
$fp = fopen("welcome.txt,"w+") or die("Unable to open file!"); //checks for read-write access, dies if not able to open

is this what you are looking for ?


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question