Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
joanmjc  
#1 Posted : Friday, September 25, 2009 4:27:49 AM(UTC)
joanmjc

Rank: Member

Groups: Member
Joined: 11/26/2008(UTC)
Posts: 17

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

joanmjc  
#2 Posted : Friday, September 25, 2009 9:43:13 AM(UTC)
joanmjc

Rank: Member

Groups: Member
Joined: 11/26/2008(UTC)
Posts: 17

Someone please! Thats all I need to get it done!
joanmjc  
#3 Posted : Sunday, September 27, 2009 10:13:30 PM(UTC)
joanmjc

Rank: Member

Groups: Member
Joined: 11/26/2008(UTC)
Posts: 17

please some for christ sake i need it!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.