Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to transfer filename & full path from localsystem ?

Status
Not open for further replies.

ulag

Programmer
Sep 4, 2001
23
US
I need to know the filename and full path, which will be loaded after some time.

eg
I need this as one variable
"C:\Documents and Settings\ulag\My Documents\b_card.doc"

It is so simple, but I have problem.

Please help me.

When I load, I get like this in my local system
"C:\WINDOWS\TEMP\php656.tmp"
 
No. File_name will give only the file name. Not entire path.
The path we discuss only give the path name in server not the client.

I need to know client's path address reference to his computer system
I mean from which directory he uploaded.
Which we see in the upload path, which is provided by client system. I want this to be trnasferred as variable.

The link you provided is nothing related to my question.
 
The client-side path to the file is not carried over with the uploaded file because it is not germaine to the transfer process.

Add a hidden field to your form. Add Javascript which copies the value of the file field (which should be the client-side absolute pathname) to the hidden field before the form is submitted.


And my signature line applies to all activity in Tek-Tips. Want the best answers? Ask the best questions: TANSTAAFL!
 
My question is about file uploads so I thought I'd put it in here.

I'm using:
move_uploaded_file ($userfile, "destination"); and I don't know what the destination path should be.

The location I want it is:
absolute: relative: /files
my php file is in the test directory.

I don't know whether I have to specify the filename aswell as the path and whether I can use a variable as part of the destination.

<?php
// $userfile is posted from form
if (is_uploaded_file($userfile)) {
move_uploaded_file($userfile, &quot;/place/to/put/uploaded/file&quot;);
} else {
echo &quot;Cannot upload: filename ’$userfile’.&quot;;
}
?>
 
I've found the answer to my question.

In my case the path I needed was &quot;/
I now have a new problem. In the code posted in my previous message, I'm using: if (is_uploaded_file($userfile))

My problem is that it is false if it runs immediately but I don't want to leave an indefinite pause before testing for it or do a loop to keep checking it.

Ideally I want something along the lines of:
if the file is uploading
when it's finished
do this

I can't find any suitable functions to do this.
 
If anyone is interested in the saga of my stupidity it is as follows:

When you submit a form the files are uploaded before the php is run so there is no need for a delay before checking if the file is uploaded, it either is or will never be.

My problem was that I missed out the enctype=&quot;multipart/form-data&quot;
from my form tag so my files were not getting uploaded.

I hope this helps someone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top