Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9253787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:18:23+00:00 2026-06-18T11:18:23+00:00

I have a simple .php file: <?php $archivo = $_POST[name]; $alineamiento = $_POST[alineamiento]; $fp=fopen($archivo,w);

  • 0

I have a simple .php file:

<?php
$archivo = $_POST["name"];
$alineamiento = $_POST["alineamiento"];
$fp=fopen("$archivo","w");
fwrite($fp,$alineamiento);
fclose($fp);
?>

This works fine, but when I need to write the file in a subfolder (sub_mat):

<?php
$archivo = $_POST["name"];
$alineamiento = $_POST["alineamiento"];
$fp=fopen("/var/www/SChip/sub_mat/$archivo","w");
fwrite($fp,$alineamiento);
fclose($fp);
?>

this doesn’t work. I also try it without the absolute path dir, like:

<?php
$archivo = $_POST["name"];
$alineamiento = $_POST["alineamiento"];
$fp=fopen("sub_mat/$archivo","w");
fwrite($fp,$alineamiento);
fclose($fp);
?>

I have rw permissions in the sub_mat folder. I try this with Chrome, FF, and Opera, and it doesn’t work. I know this must be silly but I can’t figure out the problem.

EDIT

I modified the script, adding system("mv ...") and initializing the values.
If I run this in the Console it works fine, no errors, only:

PHP Notice: Undefined index: name in /var/www/SChip/create-matrix.php on line 2
PHP Notice: Undefined index: alineamiento in /var/www/SChip/create-matrix.php on line 3

but that’s obvious… But when I run in Chrome or FF it doesn’t work, no errors or warnings. It just leaves the file in the current folder, and the mv is not executed.

<?php
$archivo = $_POST["name"];
$alineamiento = $_POST["alineamiento"];
$archivo = "testing";
$alineamiento = "test2";
$fp=fopen("$archivo","w");
fwrite($fp,$alineamiento);
fclose($fp);
system("mv $archivo custom_matrices_temporal/$archivo");
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:18:24+00:00Added an answer on June 18, 2026 at 11:18 am

    The directory needs execute (x) permissions as well to allow the creation of new files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP file with one simple echo function: echo 'アクセスは撥ねりません。'; but when
This is a bit hard to explain: I have a simple PHP file that
How to manually create Friendly URLs? (PHP) So I have created simple php file
I have a simple script of code that reads a PHP file and when
I have written simple code to get content from xml file to php. $xml
I have a billboard.js script running on a simple php file and for some
I have a simple php site that I built, but for some reason my
I made this stupidly simple PHP file containing <?php class stuff { private $var;
I have a simple PHP file upload script: $path = "uploads/"; $actual_image_name = time().$session_id.".".$ext;
I have a simple PHP file with the following: <?php echo 'catid=$_GET[catid]'; <?> When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.