Change file names before uploading with SWFUpload

2019-08-08 11:12发布

I am using SWFUpload to allow users to upload multiple files in any browser. A user can provide custom file names for the files being uploaded. How can I iterate through all the queued files and update the name of the file to the custom name before the file is uploaded.

If I can't change the file name, how do I add a post parameter to each file being uploaded to make the change on the server side? I know how to add parameters for all files but how would I do it for each file?

1条回答
甜甜的少女心
2楼-- · 2019-08-08 11:44

You can't update the actual name of the file that gets sent in the POST body of the file upload because internally, SWFUpload is using a FileReference which doesn't let you change any of the file's properties before uploading it (and there's no way to get proper upload progress without using a FileReference to do the uploading, so this isn't something that can really be changed).

However, you should be able to add an extra POST parameter per file via the addFileParam function. Its signature is:

addFileParam(file_id:String, name:String, value:String):Boolean
查看更多
登录 后发表回答