26077

Change file names before uploading with SWFUpload

Question:

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?

Answer1:

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 <a href="http://demo.swfupload.org/Documentation/#addFileParam" rel="nofollow">addFileParam function</a>. Its signature is:

addFileParam(file_id:String, name:String, value:String):Boolean

Recommend

  • How to disable lane changes in SuMO?
  • Does each call within a multi() call in phpredis result in a new network roundtrip to redis?
  • Flush google analytics events manually with Google Play Services
  • JAR file: Could not find main class
  • Valums Ajax file Upload handle the up. file?
  • Crafting a LINQ based solution to determine if a set of predicates are satisfied for a pair of colle
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • Save website uploads in a subdomain
  • msbuild create itemgroup from property group
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Unable to decode certificate at client new X509Certificate2()
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Installed module is empty
  • Abort upload large uploads after reading headers
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • WinForms: two way TextBox problem
  • Symfony2: How to get request parameter
  • ORA-29908: missing primary invocation for ancillary operator
  • Calling of Constructors in a Java
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Traverse Array and Display in markup
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Transpose CSV data with awk (pivot transformation)
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Free memory of cv::Mat loaded using FileStorage API
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Angular 2 constructor injection vs direct access
  • Understanding cpu registers
  • coudnt use logback because of log4j
  • Memory offsets in inline assembly
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • Turn off referential integrity in Derby? is it possible?
  • Add sale price programmatically to product variations
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize