http://www.perlmonks.org?node_id=1081155

lightoverhead has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I am trying to apply it to my project. However I encountered some problems to get it going. I can run jQuery File Upload plugin with using its own php server-side script. it works fine. However, when I tried to write some code using your package, I have some problems. I am sorry if I am asking some naive questions as I may not fully understand how this works. My test script is as below (I just copied the one from cpan) "jq_ful.pl", in /usr/lib/cgi-bin/

#!/usr/bin/perl -w use strict; use jQuery::File::Upload; #simplest implementation my $j_fu = jQuery::File::Upload->new; $j_fu->upload_dir('/var/www/tempfiles'); $j_fu->handle_request; $j_fu->print_response;

I also changed jQuery File Upload plugin "main.js": from : url: 'server/php/' to url: 'http://localhost/cgi-bin/jq_ful.pl'

The error message from webpage is "SyntaxError: JSON.parse: unexpected end of data"

The error message from apache error log are:
[Fri Apr 04 02:45:12 2014] [error] [client 127.0.0.1] Use of uninitial +ized value $url in substitution (s///) at /usr/local/share/perl/5.14. +2/jQuery/File/Upload.pm line 173., referer: http://localhost/jQuery-F +ile-Upload-9.5.7/index.html [Fri Apr 04 02:45:12 2014] [error] [client 127.0.0.1] Use of uninitial +ized value in concatenation (.) or string at /usr/local/share/perl/5. +14.2/jQuery/File/Upload.pm line 158., referer: http://localhost/jQuer +y-File-Upload-9.5.7/index.html [Fri Apr 04 02:45:12 2014] [error] [client 127.0.0.1] Use of uninitial +ized value in string ne at /usr/local/share/perl/5.14.2/jQuery/File/U +pload.pm line 921., referer: http://localhost/jQuery-File-Upload-9.5. +7/index.html [Fri Apr 04 02:45:12 2014] [error] [client 127.0.0.1] Use of uninitial +ized value in print at /usr/local/share/perl/5.14.2/jQuery/File/Uploa +d.pm line 673., referer: http://localhost/jQuery-File-Upload-9.5.7/in +dex.html

I am wondering if any of you have experience with this package and may let me know what errors I really have here.

I actually tried to use this plugin in my perl Dancer project and tried to integrate this package and jquery plugin into Dancer codes I wrote.

Thank you very much.

Replies are listed 'Best First'.
Re: questions regarding jQuery::File::Upload (REQUEST_URI)
by tye (Sage) on Apr 04, 2014 at 15:15 UTC

    For one, jQuery::File::Upload should probably be using $ENV{REQUEST_URI} not $ENV{SCRIPT_URI}. You could try making that change and see if it fixes the problem, especially since that is the kind of thing that will depend on the environment where it is being used and so the module author might not be able to reproduce your problem.

    - tye        

      thank you tye

      but you may notice that I mentioned the server-side php script works well.

      so, it seems not the problems of environment setting.

        You might want to re-read what I wrote more carefully as I wasn't blaming your environment. I was suggesting a small change to make in the code of that module.

        - tye