Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

file_put_contents() not functioning correctly

Featured Replies

Hi all, just got Uniform Server downloaded and running, very easy indeed.

 

Although I am having a small problem with file_put_contents(). I have created a php page that generates a web site from a xml file... when I ran the script it all went ok, the files were created and could be viewed via localhost. But when I looked in the 'www' folder they didn't exsist.

 

I finally found the files in "C:\Users\Darkr\AppData\Local\VirtualStore\Program Files\Uniform Server\udrive\www"

 

So I have solved the problem, but I would prefer if the files went to uniform server's virtual drive or the install directory. Is this possible?

I don’t think it’s a UniServer problem!

The command will write a file relative to the folder where the script is run.

For example if you put this into www name it test1.php:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
</head>
<body>
<h1>Test</h1>
<p>Echo will display number of characters in the string "33"</p>
<?php
echo file_put_contents("test.txt","Pick this file up in www. Testing");
?> 
</body>
</html>

 

It will create file test.txt in www

 

The only conflict is if you have a file name that is identical to one on the include path.

 

It could be the script that is setting that path!

 

All the best

Ric :D

  • Author

Well your right, its definatly not a UniServer problem.

 

I was going to do your example to make sure it wasnt a path problem, when I got to saving the file in Notepad++ i could see the files, but I cannot see the files when going through file manager. I also noticed a 'compatibility files' button on file manager, once clicked it takes me to the folder mentioned previously.

 

So i guess its time to read up on vistas features :/

 

Thanx for your quick reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.