Search

Hi there,

Is there a plugin or another way to show progress during a fileupload? Or perhaps some way to select a file from a list of files on the server?

I am letting users upload video files which can be quite large, and they are getting confussed wheter or not the upload is done.

Thanks, Bob

It wasn't easy to set up and get working, but I've used SWFUpload with Symphony before. This is a good example. Although this was through front-end forms posting to Events, rather than the File Upload field in the backend.

Thanks nick, can you give some some small pointers how to go about this?

I pretty much copied the example above. I stripped out the other fields, and modified the handlers.js to relfect this (i.e. removing all fields except for "txtFileName" from the validation routine).

Here's a modified version of the upload script. See line 64/65 for what you can tweak. This script accepts the file upload, saves to disk, and returns an MD5 hash of the file name. You can disable the hashing to use the original file name on line 137.

My JavaScript configuration for the SWFUpload is as follows (see the HTML of the form in their example above, I have simply updated this for my requirement).

upload_url: "/assets/php/upload.php",   // Relative to the SWF file, you can use an absolute URL as well.
file_post_name: "file",

// Flash file settings
file_size_limit : "10 MB",
file_types : "*.pdf;*.avi;*.asf;*.mov;*.wmv;*.mpg;*.mpeg;*.mp4",

file_types_description : "All Files",
file_upload_limit : "0",
file_queue_limit : "1",

// Event handler settings
swfupload_loaded_handler : swfUploadLoaded,

file_dialog_start_handler: fileDialogStart,
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,

//upload_start_handler : uploadStart,   // I could do some client/JavaScript validation here, but I don't need to.
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,

// Button Settings
button_image_url : "/assets/swfupload/XPButtonUploadText_61x22.png",    // Relative to the SWF file
button_placeholder_id : "spanButtonPlaceholder",
button_width: 61,
button_height: 22,

// Flash Settings
flash_url : "/assets/swfupload/swfupload.swf",

custom_settings : {
    progress_target : "fsUploadProgress",
    upload_successful : false
},

// Debug settings
debug: false

The form HTML is along these lines:

<label>Choose file:</label>                         
<input type="text" id="txtFileName" disabled="true" />
<span id="spanButtonPlaceholder"></span>
<div class="flash" id="fsUploadProgress"></div>
<input type="hidden" name="fields[video]" id="hidFileID" value="" />

The name of the successfully uploaded is slotted into #hidFileID, and then the form is submitting. The "video" is a File Upload field in Symphony. So when a file is selected, it uploads and the filename returned and put into this form field. The form is then submitted and Symphony acknowledges that the file already exists, and populates the File Upload accordingly.

As I say, it took several hours of tinkering about but the results were entirely acceptable.

I just came across this solution for upload progress using MooTools: FancyUpload

Thanks all, I will try it out.

Would be great if there was an extension for this ;)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details