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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to upload a folder (with sub-folders) 1

Status
Not open for further replies.

ApJ

Technical User
Nov 16, 2001
8
0
0
DK
I'm trying to make a file-server, using php, where clients (with password, etc) should be able to upload and download files, almost like a FTP-server. I know this could be easily done by using a FTP server, but due to the limmitations in my project-description (final exam/project) it is not possible.
(Too long/weird intro, uh sorry ;-) )

I know how to:
Upload a single file.
Upload multiple files.
Download a single file.
etc.

But I really would like make it possible for the clients to:
1. Be able to upload a folder, with sub-folders and files (if any), from a client to the server.
2. Be able to download a folder , with sub-folders and files (if any), from the server to a client.


Currently I'm not sure it is possible at all, but if anyone know how to solve those problems, or just have an idea, I would be very happy to hear about it.

If not possible with PHP; any ideas to what language I could use? (Still need to transfer the files through http)
 
Uploading a folder or multiple folders is not possible with ANY server-side web scripting language, because it still uses the standard POST operation, which can only accept files, not directories.

In other words, there is no simple way to let a user "drag and drop" folders, unless you implement some sort of client-side applet, using Java, or ActiveX, or somesuch. even then, what the applet would have to do is somehow glob all those directories and files together into a single piece of data, upload the data with a standard POST operation, and then you would need some server-side code to parse that data and "unpack" it to create folders and files. Probably you could just use the standard ZIP compression tool, as long as you have a zip-compatible compression tool on the server side. In fact, for utter simplicity's sake, you could just request your users to zip their folders first, then upload the compressed archive, after which PHP could uncompress it using system("unzip filename"), or exec, or whatever.

Or, the only other option is to create an applet that can temporarily turn the client into an HTTP server, and serve out that information to your PHP server, which would have to request the data using "fopen", or whatever. This would be even more complicated than the above-mentioned concept. -------------------------------------------

"Calculus is just the meaningless manipulation of higher symbols"
                          -unknown F student
 
Yep, I like it too!

(Still whimpering a little over the "loss" of my Upload folder button ;-) )

It would probably bee a good idea to let the users zip the folders.

Many thanks for the detailed help rycamor, have to remember you in my "List of source material" (translated from danish not sure it's correct).

-ApJ
 
Hehe... what makes you think I was the unknown F student. I'll have you know that I passed Calculus just fine (at least, the second time). But that other student was rather legendary among professors for not *quite* getting it, apparently. (Sigh...) he's probably a member of Congress by now. -------------------------------------------

"Calculus is just the meaningless manipulation of higher symbols"
                          -unknown F student
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top