Hello!
After have fighted during 3 days with basic functions of this pretty good script, i'd like to make something special.
I will use the script to allow my users uploading their photos and pictures in different directory (a directory is a category of picture).
So i'd like to put a for the user be able to seect the directory he wants to upload to.
How can I make such a thing?
If i simply add that between < form>:
< select name="directory">
< option value="landscape">Landscape< /option>
< option value="animal">Animal< /option>
< option value="earth">Earth< /option>
< /select>
And after, in upload.php when it's time to move the file:
if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path.'/'.$_POST['directory'].'/'.$file_name)) {
HandleError("File could not be saved.");
exit(0);
}
Will it work?
Or maybe it's possible to have this working by using flash post_params, updating these params when choosing a directory? But i don't know how to do it...
Please help me doing a "choose directory" possibility 
See you soon!
post_param
Using post_param or the AddFileParam features is what you need to do. Uploads from SWFUpload are not submitted with any forms. They are independant Flash uploads. If you want to send any additional values from any HTML Forms you need to do this manually.
A solution might be to use the uploadStart event to read the form value and add it to the post_params:
function uploadStart(file) {
this.addPostParam("directory", document.getElementById("directory").value);
return true;
}
thanks for you answer. So I
thanks for you answer. So I think i understood what you want me to do
:
function uploadStart(file) {try {
this.addPostParam("directory", document.getElementById("directory").value);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus("Uploading...");
progress.toggleCancel(true, this);
}
catch (ex) {}
return true;
}
So, if I add a < select >, the javascript will add the option value to the $_POST['directory'] param?
Yeah, that should do it.
That looks like it should do it. I'm pretty sure you can get a select's value just by using the 'value' property but you might have to verify that.