Hi All, I'm using PHP thru WAMP server 2 for a project. I have some MP3 files stored on the server. Now logged in at some other client machine, I want to copy some files from the server machine to client machine thru the copy($source,$destination) function. For this i have to define a particular drive on the client machine and make a user defined directory (that client inputs in a form) where the files will be coppied. Using the mkdir($dir) function i want to create the directory and copy the files over there. The whole process is running absolutey fine on the server machine (i.e, if i log on at the server and perform the action), but it is not working on remote client machine since the mkdir function cannot create a folder in a remote client file system. Can i use the client IPadress to create a directory in the remote client machine? Or there is some other way to do this? Please help because I'm stuck with this problem for a number of days. P.S.: I do not want a save request download diolog box for individual files, nor a zipped file download. I just want to copy the specified files in a specific defined folder in client machine. My Code: $folder=$_GET['folder']; // user defined folder inputed from a form $dir="D:\\".$folder."/"; // Destination Directory to copy the files if(!is_dir($dir)) { mkdir($dir); chmod($dir,0777); } $sqlDownloadTracks=mysql_query("select filename from tbldownloadtracks where requestWishListid='$requestWishListid'"); $copiedtracks=0; $totaltracks=0; while($rowDownloadTracks=mysql_fetch_array($sqlDownloadTracks)) { $filename=$rowDownloadTracks['filename']; $file = "controlp/uploads/".$filename; $newfile = $dir.$filename; if (copy($file, $newfile)) { chmod($newfile,0777); $copiedtracks++; } $totaltracks++; } Thanks and Regards in advance.
You can't use the copy() function to copy files from a server to a client PC. You'll need to download the files through the browser (which it sounds like you can't do) or use FTP or a similar protocol to send files to the client.
Can you kindly help me with a FTP code to transfer the files ? Actually i donot want to allow download with the download dialog that popos up for every file to be downloaded and requests for a save. Since the directory for the files to be saved is pre defined and fixed (suppose in D: drive "downloadMP3" folder). And I do not want a zip file download for multiple file downloads also. I have not used any FTP or similar protocols code before, so it would be very helpfull for me if get a FTP code to transfer the files. And I also want to use the mkdir() or some similar function to create a folder in the client machine without giving the client a option to select one. Is it possible anyway ?
I think you may be going about your project the wrong way. You need to create an application on the client PC to download these things the way you want from the server. Using FTP or something similar is just a way the program on the client PC can download files from the server. If you're doing this on Windows, give visual basic.net a try. There's a free version for download on the Microsoft website.
I'm not sound with VB.net. And the project is solely on PHP. Can i implement a FTP code to create the destination directory in client machine and download all the files silently at the created directory in the client machine from the server? P.S.: The files are in the server, and for downloading the application (running on the server) has to be logged in from the client machine.