DonP
|
| Posted: 10/02/2007, 12:27 PM |
|
I am creating a series of functions for browser-based uploading and
downloading files via FTP using CodeCharge. I know that CCS has the file
upload built-in but I am doing it without a database. I have the function
working for simple uploads, however, I want to add
1) checksum with upload status
2) resume in case of failure
3) uploading multiple files at a time
to the function and have no idea how or where to begin! All the files to be
uploaded will be large so checksum and resume are most important. Can
anyone help even though it is technically not a CCS question?
Here is what I have so far for the basic uploading function:
function putFile() {
$conn = DoConn();
$currDir = CCGetSession("currDir");
set_time_limit(0); // Override php.ini setting for server time-out for
large uploads.
if ($_FILES['FileName']['name'] != "") {
$local_file = $_FILES['FileName']['tmp_name']; // Defines Name of Local
File to be Uploaded
if (!$currDir) {
$UploadDir = "/";
} else {
$UploadDir = $currDir;
}
$destination_file = $UploadDir.basename($_FILES['FileName']['name']); //
Path for File Upload (relative to your login dir)
fclose($destination_file); // Be sure marker is at beginning of file
$upload = ftp_put($conn, $destination_file, $local_file, FTP_BINARY); //
Upload the File
// Verify Upload Status
if (!$upload) {
echo "<h2>FTP upload of ".$_FILES['FileName']['name']." has
failed!</h2><br /><br />";
} else {
echo "Success!<br />" . $_FILES['FileName']['name'] . " has been uploaded
to " . $ftp_server . $destination_file . "!<br /><br />";
}
}
} // END putFile Function
Any help will be much appreciated. Thanks!
Don P
|
|
|
 |
DonP
|
| Posted: 10/09/2007, 4:51 PM |
|
Is there anyone who can help? Surely someone must have had experience in
this.
|
|
|
 |
|