473,568 Members | 2,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file 'upload'


I am trying to use a form that is usually used for file uploads to obtain a
path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file name
gets through to e.php.
Is there some predefined variable that will get the full path?
Dec 20 '05 #1
2 1641
"james troy" <je*****@comcas t.net> wrote in message
news:D5******** *************** *******@comcast .com...

I am trying to use a form that is usually used for file uploads to obtain
a path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file
name gets through to e.php.
Is there some predefined variable that will get the full path?

It should not concern the server script, what the original path and file
location of the uploaded file was, thus no such information is sent to the
server. Just the name of the original file. I'm wondering what were you
going to do with the path information. Whatever the reason, you can't do
that using the file field, it simply doesn't send such information.

Use print_r($_FILES ); to see what information of the file is provided in
php.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
an************* ******@gmail.co m.NOSPAM.invalid
Dec 20 '05 #2
Kimmo Laine wrote:
"james troy" <je*****@comcas t.net> wrote in message
news:D5******** *************** *******@comcast .com...
I am trying to use a form that is usually used for file uploads to obtain
a path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file
name gets through to e.php.
Is there some predefined variable that will get the full path?


It should not concern the server script, what the original path and file
location of the uploaded file was, thus no such information is sent to the
server. Just the name of the original file. I'm wondering what were you
going to do with the path information. Whatever the reason, you can't do
that using the file field, it simply doesn't send such information.

Use print_r($_FILES ); to see what information of the file is provided in
php.


The case where I wanted something like this, the script was generating a
report, and wanted a filename from the user, but wasn't interested in
the file. Of course I could have used a text field, but by using a file
field I got the browser to offer the user a file-browse dialogue. I
didn't manage to solve James's problem though.

Colin
Dec 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2907
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just upload files, like this: copy ($myfile, $uploadfolder . "/" . $myfile_name); Everything works fine, it can process large files and everything, but...
15
3192
by: Simon | last post by:
I would like to create a very basic file upload add image form to add to my web site and to keep them in a "tmp" directory within my web hosting file manager once uploaded. I understand the basic html for the form and the basic php scripting but the fine details ie method post etc needs help also at this stage I dont want to involve mysql...
2
3911
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in...
13
4289
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I...
2
3421
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage() fileitem = form if fileitem.file: # It's an uploaded file; count lines
7
3173
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
2
7638
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in...
1
5441
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one group get automatically re-directed after uploading. However, this member group never gets the benefit of knowing if they've uploaded an incorrect...
6
3823
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the network should be able to connect to the database and run queries on the database or upload new music that does not yet exist on the database. The uploaded...
7
7134
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page Get Started : The Official Microsoft Silverlight Site and follow Step 1. Occasionally...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.