Search

I’m working on an extension that adds a progress bar to all upload fields in Symphony. It’s a Flash/JavaScript solution, so it adds a layer on top of existing field types (native File Upload, or the Unique Upload, Hashed File Upload etc.).

View of it in action: http://nick-dunn.co.uk/assets/files/uploadify.mov

Progress so far: http://github.com/nickdunn/uploadify/tree/master

The UI is almost complete, although the JavaScript will be tidied and written as an object.

However I’m after some help with the saving of the image. Presently the upload posts to a script (upload.php included with the extension) which handles the file save:

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

    if (move_uploaded_file($tempFile,$targetFile)) {
        echo "1";
    } else {
        echo "0";
    }
}

The script correctly received the right folder, and file-selection honours the regex file extensions when creating an upload field.

However my beef is that this is bypassing the field’s own upload mechanism. If I apply the JS to a Hashed Upload Field, the hashing mechanism won’t be applied since I’m just uploading with a different script. What I’m after is a Symphony solution.

What I think it needs is a content page in the extension that:

  • accepts a field ID and instantiates that field in PHP
  • accepts the $_POST array and correctly uploads the file (using the field’s checkPostFieldData/processRawFieldData methods)
  • returns the new file name, but without creating an entire entry
  • returns an error if not successful

So I want to call the upload on an instantiated field, but without creating an entry. Would any extension aficionados care to lend a hand?

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