Solved

full path from a browse button (contd ..)

Posted on 2008-09-30
2
590 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
The viewer will learn how to count occurrences of each item in an array.
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 …

762 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

23 Experts available now in Live!

Get 1:1 Help Now