Search

A new Extension, “Unique Upload Field” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

This extension, just like the Hashed Upload Field extension by Rowan Lewis, provides an upload field which allows multiple copies of the same file to be uploaded to the same location. Indeed this is no more than a variation of Rowan’s extension. This is why I left his name in the license file.

The difference is: The Unique Upload Field will retain the filename and simply append the current UNIX timestamp to it. Thus, human readable filenames are preserved and alphabetical sorting makes manual handling of files on the server rather easy.

The extension uses PHP’s preg_replace function and will crop the filename (i.e. w/o file extension) to a fixed lenght.

Please note that on UNIX filesystems filenames (including the file extension, like ‘.jpg’) are limited to 255 characters in length. Theoretically you could run into problems without any cropping.

Get it from Github.

Version 1.0 (2009-05-06)

  • it’s on Github now!

Version 0.9 (2009-02-07)

  • Initial release
  • Compatibilty: Should work with any official version of Symphony 2.
  • Cropping length is 33; since unix timestamp is 10 digits, filename lenght will be limited to (33+1+10 = 44) characters. Finding the ideal cropping length is not easy. Please post your feedback on this.

[EDIT]: Deleted the attachment link. You may find the current version on Github (see above).

For those who would like to play with the preg_replace stuff (around line 14 in field.uniqueupload.php), here is how you might start without using cropping:

return preg_replace('/(.*)(\.[^\.]+)/', '$1-'.time().'$2', $filename);`

And this is the actual crop and add timestamp code used in release 0.9:

$crop  = '33';
return preg_replace("/(.*)(\.[^\.]+)/e", "substr('$1', 0, $crop).'-'.time().'$2'", $filename);

The download link doesn’t work since being moved to the new forum system :(

The download link doesn’t work since being moved to the new forum system :(

Fixed

Github cough :-P

OK, I finally managed to push this to Github!

In Symphony 2.0.7 the annoying file upload bug (“impossible to upload an image with the same name twice”) has been fixed. This was the reason to build this extension.

Is there still a need for this with 2.0.7? (If not, I would add a remark to the extension’s description.) Thoughts are appreciated.

Is there still a need for this with 2.0.7? (If not, I would add a remark to the extension’s description.) Thoughts are appreciated.

I think there is. This extension solves the problem of two separate entries uploading the same filename too, right?

Yes, you are right, of course.

Case closed. :-)

in 2.0.7 this field show “undefined” instead of “Remove”

This is a known bug in Symphony’s localisation features which will affect all JavaScript related fields and extensions.

Another bug that should not exist in final product.

I applied path discussed in that topic, and nothing changed for me.

Please make sure you replaced both files and clear your browser cache.

I’ve downloaded whole admin.js file from YOUR intergration, and now it’s working.

There are two files in the commit: You have to update content.ajaxtranslate.php aswell. Hope that solves your problem.

Yes, it solves, thanks.

I’m getting a fatal error when the field isn’t required and is empty on saving an entry. It’s basically saying it can’t be NULL in the database.

I’ve attached the output. I’m using Symphony 2.1.0

Also, what might be a stupid question… How hard would it be to swap out the Unique Upload Field for the bog standard File Upload Field without having to re-upload every file?

Attachments:
symphony-fatal-error.pdf

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