Solved

full path from a browse button (contd ..)

Posted on 2008-09-30
2
592 Views
Last Modified: 2013-12-13
Hi,

1)    I was suggested by this forum to use swfupload to get full directory name from a path. My php guy is not on his seat and i need to deliver this so , how is it possible to use this to get the full path (directory) from a browse button and send it to the back end.

2)    I found a piece of code which would display the directory name. How is it possible to send this information to another page.

BRgds,

kNish
<html>

<head>

<title>Return file directory</title>

<script language="JavaScript">

 function GetDirectory() {

  strFile = document.MyForm.MyFile.value;

  intPos = strFile.lastIndexOf("\\");

  strDirectory = strFile.substring(0, intPos);

  alert(strFile + '\n\n' + strDirectory);

  return false;

 }

</script>

</head>

<body>

<form name="MyForm">

<input type="file" name="MyFile">

<input type="button" value="Get directory" onClick="GetDirectory();">

</form>

</body>

</html>

Open in new window

0
Comment
Question by:eyeqube
2 Comments
 
LVL 5

Accepted Solution

by:
crush83 earned 125 total points
ID: 22604670
You could send it to another page in $_SESSION or in the query string and retrieve it with $_GET. For example, direct user to a link like this:

http://www.yourdomain.com/yourpath?dir=thedir

Then use $_GET['dir'] to retrieve the value of dir, where 'thedir' would be dynamically inserted by your getDirectory() Javascript function.
0
 

Author Comment

by:eyeqube
ID: 22612321
Hi,

         I have it fixed for now. I find that the method="GET" works where sometimes "POST" would not work. Is that possible. How do i ensure that the post work's coz i know GET definitely works.

BRgds,


kNish
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now