wilsonf1 Posted July 12, 2008 Share Posted July 12, 2008 Hi im not that used to php as an asp programmer but im doing my best. i have a cool script which uploads files from my CMS to my remote hosting. The only problem is, if a folder doesnt exist on LIVE and my $source_file refers to a location inside a folder structure, then the ftp upload falls over as it cant see that dir on line - can i say if doesnt exist create the folder(s)?????? $destination_file = "htdocs/CMS_FILES/". $file; $source_file = "E:\Inetpub\wwwroot\cms.jwilson\_websites\www_mysite_com\_website/". $file; if ($file=="." || $file==".." ) { } else { $upload = ftp_put($connection_id, $destination_file, $source_file, FTP_BINARY); if (!$upload) { echo("<p>FTP upload has failed!</p>"); } else { echo("<li>Uploaded <strong>$file</strong></li>"); } } } Link to comment Share on other sites More sharing options...
justsomeguy Posted July 14, 2008 Share Posted July 14, 2008 You would have to check yourself and create the folders if they don't exist. You can use ftp_nlist to get a list of files and directories in a certain directory to see if the one you're looking for exists, and you can use ftp_mkdir to create a directory and ftp_chmod to set the permissions. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.