How do I set the uploaded files folder for SWFUpload?

纵饮孤独 提交于 2019-12-04 10:55:23
Ólafur Waage

What you do is call a PHP script, and that script handles the file uploading.

You can turn on debug, this will give you a pretty nice debug view of what is happening, and the output of the PHP file in question.

The flash doesn't handle the uploading because the flash is actually running on the client machine.

Here's an example of the config I use.

    flash_url : "js/swfupload/flash/swfupload.swf",
    upload_url: "ajax/flash_upload.php",
    post_params: {"PHPSESSID" : "<?php echo session_id(); ?>", "folder_id" : "<?php echo $_SESSION["folder_id"]; ?>"},
    file_size_limit : "100 MB",
    file_types : "*.*",
    file_types_description : "All Files",
    file_upload_limit : 100,
    file_queue_limit : 0,
    custom_settings : {
        progressTarget : "fsUploadProgress",
        cancelButtonId : "btnCancel"
    },
    debug: true,

Then flash_upload.php has something like this (just an example)

$location = "/var/www/html/example.com/files/";
move_uploaded_file($_FILES["Filedata"]["tmp_name"], location .$_FILES["Filedata"]["name"]

SWFUpload is given a URL to send the upload to, e.g. http://yourdomain.com/upload.php - it is this script which determines what will happen to the upload.

See the PHP Manual section on Handling File Uploads for more information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!