View Full Version : getting a directory path from the user
05-03-2004, 05:51 PM
I am creating a system where files will be uploaded into the server, then I want to let the user to select a path of a directory in his PC where he want these files to be in his PC..
Can some give hints how to use php to make my system do such functionality?
(getting the path from the user by letting him browse the directory in his PC)??? :(
05-03-2004, 06:18 PM
This has nothing to do with PHP, but all you have to do is make a "file" text field, like so -
<input type="file" name="file_to_upload" size="20">
05-03-2004, 06:28 PM
but this will enforce the user to select a file, what I want is just the directory where the files will be downloaded there...
think it through and you'll realise it would be a huge securityhole if you could force downloading files into a specific directory on the client.
you need to let the client decide which file he downloads and stores where.
05-03-2004, 07:08 PM
This wont really be possible... The only slight possibility is if the user had a http server set up with the root in the C:\ drive (no-one in their right mind would ever do that).
In terms of controlling files ect, there is no way to pre-define the value of a file upload, again, for security reasons, so what you are trying to do will be pretty much impossible.
05-03-2004, 08:01 PM
but my simple thinking that it just like downloading file, what the user must do is just to browse the folder he want the folder to be downloded in....? :(
05-03-2004, 08:44 PM
if you just want to direct a user to a place on their harddrive, then you should be able to use the full path, eg:
file://C:/Documents and Settings/user/My Documents
05-03-2004, 09:15 PM
So I will refhrase my question....
How can I get the full path from the user from a browse window, not letting him to write it in a text field for example (This is because I am very kind and I want to make the user life easier)... :D
05-03-2004, 09:23 PM
05-03-2004, 09:44 PM
I will explain what my system should do in short...
first the scope of my system will be between students and a teacher..
so the story begin when each student is going to submit his assignment in a zipped folder this folder will go directly into a specified directory in the server when the student submit his assignment...Now the role of the student is finished...
The teacher will come and this scenario must happen>>>
The teacher will press a button (Unzip Folders), when pressing this button a browse dialoge must pop up so the teacher must select a folder where the folders that were submitted by the student must be unzipped and the placed there....
I finished implementing the student scenario, just remaning the teacher scenario..
I can imagine that specifying the path by the teacher, is like specifying the root in dreamweaver... :confused:
If you create a zipfile and then show a link to that file, then this should be enough. If the teacher clicks on that link, his browser will automatically open a dialogscreen asking him if he wants to open the file or save it + where he wants to save it.
This dialogbox, where the client himself browses to the directory, is the only right way to handle this.
05-04-2004, 12:25 PM
but our teacher dont want to this for each zipped file, he just want to click a button and all the files will be unzipped.... :(
05-04-2004, 03:11 PM
if you know the path in advance .. ( you may be able to guestimate it given a known logical filesystem e.g. C:/students/$student_name/$data_name ) you can create an executable winzip file which will extract to wherever you configure , but I suspect your next Q will be how to do that from the winzip command line version & I have not a clue !
05-04-2004, 04:58 PM
What if I refhrase my question as the following...
When the teacher come to see a page with all the files that were submitted by the student there( for the time being assume that they are normal files not zipped), so there will be a button at the button which has a lable "Copy these files to your PC" when the teacher clicks on this button the browse dialoge will appear so the teacher will chose a folder or a directory where all the files will be copied there....
My question what is the peace of code so whnen the teacher clicks the button the browse dialoge will appear to let me select a folder, and then I can get the total path of the directory had been selected?????
05-04-2004, 05:19 PM
unless you zipped all the zips, each file would have to be downloaded separately... Why not use FTP through Internet Explorer to use a drag and drop windows interface?
(just make sure it has FTP access allocated)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.