Would you tell me how to combine this#################################################
<?php
// Check that all files are uploaded
if (array_key_exists('FileCount', $_POST))
{
// ...
// Iterate through uploaded data and save the original file and thumbnail
// ...
}
//This variable specifies relative path to the folder, where the gallery
//with uploaded files is located.
$galleryPath = "subidos/";
$absGalleryPath = realpath($galleryPath) . "/";
//Get total number of uploaded files (all files are uploaded in a single package).
$fileCount = $_POST ["FileCount"];
//Iterate through uploaded data and save the original file and thumbnail.
for ($i = 1; $i <= $fileCount; $i++)
{
//Get source file and save it to disk.
$sourceFileField = "SourceFile_" . $i;
$fileName = $_FILES[$sourceFileField]["name"];
move_uploaded_file($_FILES[$sourceFileField]["tmp_name"],
$absGalleryPath . "/" . $fileName);
//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
$thumbnail1Field = "Thumbnail1_" . $i;
move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"],
$absGalleryPath . "/Thumbnails/" . $fileName . ".jpg");
}
?>
######################################
With this:
iterate through each file (i)
{
//This value is taken from the FileName_i POST field
string fullPath
//This value is pre-defined
string galleryPath
//The 'split' function splits a string into an array of substrings using
//the specified delimiter ('\' in our case)
array folderStructure = split(fullPath, "\")
//The 'goToFolder' function changes the current working folder to the
//specified one
goToFolder(galleryPath)
iterate through each element of folderStructure (j)
{
//The 'exists' function checks if the specified folder exists under the
//current location
if not exists(folderStructure[j])
{
//The 'createFolder' function creates a subfolder
createFolder(folderStructure[j])
}
goToFolder(folderStructure[j])
}
//The 'save' function saves the current file in the current working folder
save(file[i])
}
################################################
that way i can upload files and folders in the same order as on the computer, ive tried but cant combine both codes to work as I wish
Edited by user Friday, September 25, 2009 4:49:51 AM(UTC)
| Reason: Not specified