Install samples or demos

Hi, I'm new in SWFUpload than I bag your pardon if my question isn't so smart:
how to install the scripts to get SWFUpload works on my server ??
I've made many upload scripts in php but here I can't find where is the upload path, it seems to be the same dir where the script is located but the files doesn't come to the server even if the result say "# files uploaded".

Thank You for any suggestion !!
R.

gyphie's picture

Paths

The upload.php path is relative to the swfupload_f9.swf file. The demos use relative paths but this is generally problematic. You might try absolute paths.

You can also check your web server logs to see what file SWFUpload is trying to access.

Hi gyphie, thank you for

Hi gyphie, thank you for your answer,
the upload path that you mean seems to be right, thank you,
but it doesn't fix the problem:
in the upload.php scripts I don't find the call to the function "move_uploaded_file" that should get the files from the tmp directory and than move it to my choosen dir.
Do you also mean that with this function I can use relative or absolute paths as I like ??

Now I've modified the script adding this line to the empty else clause present in upload.php:
if (isset($_FILES["Filedata"])) {
echo $_FILES["Filedata"]["error"];
}
else
{
move_uploaded_file($_FILES['Filedata']['tmp_name'], $myabsolutepath."/".$_FILES['Filedata']['name']);
}

Do you think this is the right way to make it works ??
(but at the moment it doesn't works anyway !!)

Thanks for your support !!
R.

gyphie's picture

Misunderstanding

It sounds like I misunderstood your question.

The demos do not do any saving of files. You need to create your own upload.php that handles the file received from the browser.

Your snippet above will not work. If the uploaded file is available then it will echo the error status value, otherwise (if the file is not available) it will try to save it (which of course will cause an error).

Thank You for you

Thank You for you suggestion,
it seems to do the opposite of my needs !!
But how to obtain the echo of upload.php ?? As it is it doesn't echoes anything !!

gyphie's picture

uploadSuccess

You must use Flash Player 9.0.28 or later. Everything the upload.php script echos is returned to SWFUpload and is available in the uploadSuccess event handler in the second parameter.

function uploadSuccess(file, serverdata) {
alert("The server said: " + serverdata);
}

For information on move_uploaded_file check the PHP website and documentation. You can also look at the upload.php in the SWFUpload samples (not in the demos) which has a pretty thoroughly written php sample upload script.