kongondo

Module: Jquery File Upload

40 posts in this topic

As for your question about image replacement: I think it would be easiest to either extend FieldtypeFile or modify FieldtypeImage as a new module (and/or their related Inputfields - am not sure). What exactly are you after? I ask because I know there are some cool changes coming to the 'standard image field' and those might just meet your needs.

actually i'm only very eager about client side image resizing. i know that this is on the roadmap for 2016 but that can be everything between next blog post tomorrow and december ;) maybe you have some more details?

i'm getting offtopic here so i started a new thread in pub: https://processwire.com/talk/topic/12861-feature-wishlist-for-shortly-planned-developments/?p=116757

Share this post


Link to post
Share on other sites

Update: Jquery File Upload Version 0.0.3.

Changelog

  1. Fixed an issue that caused duplicates in image gallery
  2. Some minor enhancements
Glad to also announce that I've tested and can confirm that Jquery File Upload is compatible with ProcessWire 2.8.x and ProcessWire 3.x 
3 people like this

Share this post


Link to post
Share on other sites

Update: Jquery File Upload Version 0.0.4.

Changelog

  1. Fixed a small bug introduced during the last commit. This causes some images not to be displayed in image gallery.
1 person likes this

Share this post


Link to post
Share on other sites

@kongondo love the module, it's helped me get past a hurdle. One issue I'm encountering is uploading more diverse file types - zip and various Adobe types. Is this something that the module can support? If so, any ideas what I'm doing wrong?

I've added  allowedNonImageMimeTypes under the ajaxoptions('application/pdf', 'application/postscript', 'application/octet-stream', 'application/x-compressed', 'application/x-zip-compressed') and added the extensions to the acceptfiletypes under jfuoptions. The files show up, I get upload progress, and then I get the message:

Empty file upload result
 
Nothing shows up on the server. If I upload JPGs or PDFs - either on their own or at the same time as non-working files - they work just fine.
 
I'm on PW 3.0.42.

Share this post


Link to post
Share on other sites

@kongondo thanks - I'm new to alot of this and just starting to figure it out. These forums and the modules have taught me alot!

I don't believe any of those apply - the server is running PHP 5.4+ on Linux. 

Share this post


Link to post
Share on other sites

@Chris Whissen,

Hmm. It means, then, that the reason they are not passing validation is because they are failing the PHP mime type tests. This is either because their mime types are unknown or the 'files are not what they seem' (aka faked files)':

  • Can you confirm you are passing the allowedNonImageMimeTypes to processJFUAjax()
  • If they don't contain any sensitive data, is it possible to PM a couple of those files getting rejected to help me debug this further?

Share this post


Link to post
Share on other sites
6 minutes ago, kongondo said:
  • Can you confirm you are passing the allowedNonImageMimeTypes to processJFUAjax()

Yes. I'm doing it like this:

'allowedNonImageMimeTypes' => array('application/pdf', 'application/postscript', 'application/octet-stream', 'application/x-compressed', 'application/x-zip-compressed'),
Quote
  • If they don't contain any sensitive data, is it possible to PM a couple of those files getting rejected to help me debug this further?

No problem. I'll have something to you in a moment. I personally created the Zip in Windows and the AI in Illustrator, so they shouldn't be fake. 

Share this post


Link to post
Share on other sites

@kongondo I'm an idiot and thank you for your time and help. I reread the module a little closer and realized I need the acceptfiletypes twice - once for Ajax options and once for JFUoptions. I only had it once. Added that in and everything is working fine. Apologies for wasting your time, truly appreciate the help.

Share this post


Link to post
Share on other sites

No worries. Had just come to that conclusion just before your response. Actually, I am the idiot! I notice that 'acceptFileTypes' is not documented! Users shouldn't have to read the module code to know how to use it :o! When I get the time.....(ahem..). Yes, so what was happening is that good ol' WireUpload was rejecting those file extensions at this point. Glad you got it sorted and now thanks for the reminder that I'll need to update the docs :)

1 person likes this

Share this post


Link to post
Share on other sites

So, I'm stretching my knowledge here and can't quite figure out an issue. If I'm logged in to PW and go to front-end upload page, everything works fine.

If a guest attempts to upload a file, they get an "Internal Server Error."

I'm guessing it has something to do with the security, specifically(emphasis added):

On 1/28/2016 at 9:39 PM, kongondo said:

Server-side, no Ajax requests are honoured unless specifically set via configurable options server-side.

I'm not sure what I need to be doing for that though. I've tried to figure out on my own, but am not having much luck. Can anyone point me towards how to make this work? (Assuming there's no other obvious reason for the error.)

EDIT: Just to narrow possibilities, I created a user with guest permissions. If logged in, uploads without issue. It's only an anonymous user that can't upload. Which is an essential function for this site. Am I overlooking something obvious?

Edited by Chris Whissen
clarification

Share this post


Link to post
Share on other sites

Okay, I managed to get it to work, but I'm not sure it's the best and safest way to do it. Ran Tracey Debugger and got "This request was aborted because it appears to be forged." error message. I did some research on that and disabled protectCSRF through config.php ($config->protectCSRF = false;). Now. anonymous uploads work fine.

I'm not sure if that's the right way to do it, but I'm also not sure this is the right post to be asking - that might be more a ProcessWire issue than this module.

Share this post


Link to post
Share on other sites
16 hours ago, Chris Whissen said:

If logged in, uploads without issue. It's only an anonymous user that can't upload

Guests should be able to upload. I am not sure what's happening in your case. Just to be sure, I've double checked in PW 2.7, 2.8 and 3. Guests (meaning frontend users not logged in [anonymous if you like]) can upload just fine.

16 hours ago, Chris Whissen said:

I'm not sure if that's the right way to do it, but I'm also not sure this is the right post to be asking - that might be more a ProcessWire issue than this module.

There's no issue with the module nor with ProcessWire (I believe) in this case :). There's something else going on in your install I suspect. Some setting or hook or similar?

1 person likes this

Share this post


Link to post
Share on other sites

Thanks for looking into it @kongondo. I have quite a few modules running, so there could be something in there making a mess of things. Another mystery to solve - at least that one can wait a bit. Appreciate the help and love the module!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By FIA2008
      How can I change the output of `Page::render`?
      I've created a hook before page::render, but when I set the $event->return to something else, my whole page is replaced with that value.
      For example:
       
      public function beforePageRender(HookEvent $event) { $event->return = 'blaat'; } This will cause my whole page to be nothing more than just 'blaat'.
      What I want, is that my menu, footer etc. are still visible but only the content of that page is replaced.
    • By kixe
      Today I have been running in mysql errors using @renobird s Module MarkupActivityLog which still uses mysqli Driver.
      @all developers
      Although mysqli is still supported PDO driver is the default database driver in PW since https://processwire.com/about/news/introducing-processwire-2.4/
      and its strongly recommend to all module authors to use/change-to PDO driver instead of mysqli.

      @renobird I have sent a pull request.
       
    • By Nurguly Ashyrov
      NOTE: This thread originally started in the Pub section of the forum. Since we moved it into the Plugin/Modules section I edited this post to meet the guidelines but also left the original content so that the replies can make sense.  
      ProcessGraphQL
      ProcessGraphQL seamlessly integrates to your ProcessWire web app and allows you to serve the GraphQL api of your existing content. You don't need to apply changes to your content or it's structure. Just choose what you want to serve via GraphQL and your API is ready.
      Warning: The module supports PHP version >= 5.5 and ProcessWire version >= 3.
      Links:
      Zip Download Github Repo ScreenCast  
      At this moment the module is not available from the modules section. Please refer to the Readme to learn more about how to use the module.
       
      Original post starts here...
      Hi Everyone! I became very interested in this GraphQL thing lately and decided to learn a bit about it. And what is the better way of learning a new thing than making a ProcessWire module out of it! 
      For those who are wondering what GraphQL is, in short, it is an alternative to REST. I couldn't find the thread but I remember that Ryan was not very happy with the REST and did not see much value in it. He offered his own AJAX API instead, but it doesn't seem to be supported much by him, and was never published to official modules directory. While ProcessWire's API is already amazing and allows you to quickly serve your content in any format with less than ten lines of code, I think it might be convenient to install a module and have JSON access to all of your content instantly. Especially this could be useful for developers that use ProcessWire as a framework instead of CMS.
      GraphQL is much more flexible than REST. In fact you can build queries in GraphQL with the same patterns you do with ProcessWire API.
      Ok, Ok. Enough talk. Here is what the module does after just installing it into skyscrapers profile.

      It supports filtering via ProcessWire selectors and complex fields like FieldtypeImage or FieldtypePage. See more demo here
      The module is ready to be used, but there are lots of things could be added to it. Like supporting any type of fields via third party modules, authentication, permissions on field level, optimization and so on. I would love to continue to develop it further if I would only know that there is an interest in it. It would be great to hear some feedback from you. I did not open a thread in modules section of the forum because I wanted to be sure there is interest  in it first.
      You can install and learn about it more from it's repository. It should work with PHP >=5.5 and ProcessWire 3.x.x. The support for 2.x.x version is not planned yet.
      Please open an issue if you find bugs or you want some features added in issue tracker. Or you can share your experience with the module here in this thread.
    • By Macrura
      Released:
      http://modules.processwire.com/modules/jquery-ion-range-slider/
      The built in rangeslider is good, but it is somewhat limited if you need really specific slider interfaces, like with pips and showing the value on the handles.
      There are many Jquery rangesliders, but one of the best and easiest to implement is the ion.rangeSlider.
      http://ionden.com/a/plugins/ion.rangeSlider/en.html
      This is a preview of the very simple module that basically allows you to enable the ion.Rangeslider on any text input, and then you type in your params into the textarea field (careful, you can break the page's javascrpt if you are not careful!) There are way too many options to really make this configurable, so the easiest way it to have a free text field where you enter any params. The params are just passed to the instance of the slider.
      Features of ion.Rangeslider:
      Skin support. (5 skins included and PSD for skin creation) Any number of sliders at one page without conflicts and big performance problems Two slider types single (1 slider) and double (2 sliders) Support of negative and fractional values Ability to set custom step and snap grid to step Support of custom values diapason Customisable grid of values Ability to disable UI elements (min and max, current value, grid) Postfixes and prefixes for your numbers ($20, 20 € etc.) Additional postfix for maximum value (eg. $0 — $100+) Ability to prettify large numbers (eg. 10000000 -> 10 000 000 or 10.000.000) Slider writes its value right into input value field. This makes it easy to use in any html form Any slider value can be set through input data-attribute (eg. data-min="10") Slider supports disable param. You can set it true to make slider inactive Slider supports external methods (update, reset and remove) to control it after creation For advanced users slider has callbacks (onStart, onChange, onFinish, onUpdate). Slider pastes all its params to callback first argument as object Slider supports date and time  
      Screenshots comparing Inputfield Rangeslider (Soma) vs. JqueryIonRangeSlider...
      1) basic range using currency
      '
      Same with different skin

      Range of years

      Same with narrower column and different skin..

       
      the module is functional and being used on 1 site, but some additional testing is needed...
    • By FIA2008
      I'm using PHPdocumentor to generate documentation of my modules, but it fails to scan the .module files. Is there another way of making processwire see a module other than giving it a .module extension?
      I'd like to rename my module file to .php but then processwire no longer sees my module.