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

  • SEARCH
  • Home
  • 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 7541787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:59:06+00:00 2026-05-30T07:59:06+00:00

Our site creates files on-the-fly that present user-specified data to the world on the

  • 0

Our site creates files on-the-fly that present user-specified data to the world on the web.

There is in each such ‘_present.php’ file a form that needs to post to itself — only problem is, the file is created dynamically based on uploaded user data and the filename is also somewhat arbitrary.

Here’s the process

 1) a 'standard' file called _present.php has a common form "TheForm" in it
 2) this file,  _present.php, is copied to Yf9iZ17a.php (for example) when 
      the user uploads data -- and from that point, Yf9iZ17a.php presents 
      that user's just-uploaded data
 3) and "TheForm" is inside this Yf9iZ17a.php, which again is just a copy of 
    _present.php, but modified to handle the user's just-uploaded data

Pretty simple. _present.php has “TheForm” inside it; the user uploads their data; we copy _present.php to a
filename for that user’s data.

The PROBLEM is — we need TheForm to post to its own
filename, which is dynamically created.

In other words, this won’t suffice:

 <form name="TheForm" method="post" action="_present.php">

However, this WOULD work:

  <form name="TheForm" method="post" action="Yf9iZ17a.php">

But we cannot hard-code the form’s html with “Yf9iZ17a.php” because — that filename is created
dynamically, on-the-fly, at runtime.

This is one failure we have succeeded in executing:

     <form name="TheForm" method="post" action="<?php echo __FILE__ ;  ?>">  

A ‘View Page Source’ sure enough proves that “php echo FILE” correctly echos the
full path (not relative path, the full path) to Yf9iZ17a.php.

Well that won’t work. Giving the browser the fully-qualified pathname to a file —
a file that is on the server — well why would you WANT to do it in the first place unless
you’re grasping at straws. So that was a failure.

Surely this comes up, dynamically created filenames whose internal forms must post to those filenames —
what’s the best way to solve this problem?

  • 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-05-30T07:59:09+00:00Added an answer on May 30, 2026 at 7:59 am

    You can use this instead, perhaps?

    <?php echo basename(__FILE__); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Throughout our site there's a common model, let's say Video, that has a number
We are developing a site inside a CMS that pushed files to our production
I have two *.sql files that I use when creating a new web site
Our site has multiple wizards where various data is collected over several pages, and
I have an automated job that pulls files that are uploaded to our servers
I have been developing our php based site on a development box that was
I am following MSDN's walkthrough on Creating a Web Site with Membership and User
Here's our scenario: We've created a sharepoint 2007 calendar on our intranet site We
Our site is running ASP.NET 1.1, and I need to have ASP.NET 2.0 running
Recently our site has been deluged with the resurgence of the Asprox botnet SQL

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.