Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


File Upload plugin has invalid URL requested on upload

edited September 2010 in Questions
This discussion is related to the FileUpload addon.
"POST /post/upload/UploadAttachment_1 HTTP/1.1" 404

Lack of URL rewrite again, perhaps? :)

Comments

  • So it appears. You can fix it yourself in the javascript I imagine with little effort. Just search for that string and replace it with:

    /index.php?p=/post/upload/UploadAttachment_1
    It's a pain to have to tweak all of your plugins when you have Friendly URLs off, but it's generally pretty easy to do.

    Obviously, the easiest thing to do is to just turn on URL rewriting! I'm still waiting for a lighttpd guru to come in and write some rewrite rules so I can switch over (or for me to be crazy enough to figure it out by trial and error).
  • TimTim Lord of Servers Vanilla Staff
    We'll be doing an internal fix for all our Vanilla addons to make sure we're using gdn.url(). Sorry for the trouble.

    Vanilla Forums Senior Developer [GitHub, Twitter, About.me]

  • Lykaon, you could try this for lighttpd, if you have mod_magnet: http://redmine.lighttpd.net/projects/lighttpd/wiki/AbsoLUAtion

    It's for drupal but the rewrite rules look suspiciously familiar...
  • edited September 2010
    @petern: I do have mod_magnet. In fact, I'm using it for handling my Wordpress rewrite rules. I had forgotten all about it. That's a good lead for me to hunt down! Thanks!
  • edited September 2010
    @Tim, @Petern: I totally solved this booger! The problem is that those jquery ajax calls for the pop-ups are basically appending this on the end:

    &DeliveryType=VIEW
    The lighttpd rewrite rules floating around would hence generate a URL that looked like this:

    http://web_root/profile/picture&DeliveryType=VIEW
    So that's obviously horribly wrong. The ajax doesn't know that it's argument doesn't make any sense. As a matter of fact, I'm not sure I fully understand how the Apache rewrite rules get around this.

    So thanks to the lead to look at writing a lua script, I totally fixed this thing up for lighty. I basically take the request the user made and then append to the back end of the query (p=/blah/blah/blah) with an & and anything that was in the query before.

    I gotta clean it up a bit and stuff, but I think this is the solid answer that Lighttpd fans have been looking for. It requires mod_magnet, but hey -- it's a solution!
  • edited September 2010
    The script in that link worked as is for me, except I set prefix to '' and changed the q= to p=, though I haven't tested all my plugins :)
  • edited September 2010
    @petern: Ha. Well I wrote one from scratch... because I'm stupid. Posted it here:

    http://vanillaforums.org/discussion/12811/how-to-lighttpd-rewrite-rules
  • I have the same problem with FileUpload not linking properly to the upload. Don't mean to sound rude, but is there a fix in layman's terms? Hopefully with code?
  • Yes me too, the upload takes the page to an invalid url, if there is a need to change the code, whats the file name of the page where the code can be changed
  • I was having the same problem where the thumbnail was linking to a 404 page. Here's how I fixed it.

    Open FileUpload/views/link_files.php

    On line 19:

    Replace
    $DownloadUrl = Url(MediaModel::Url($Media));

    With
    $DownloadUrl = MediaModel::Url($Media);
  • lucluc ✭✭
    edited June 2011
    I think I recently saw a fix (on github, maybe not for this plugin) for something similar from Url to Asset, as Url was not OK for both nice URLs and not rewriten ones.

    Maybe you could try that too. As it should work for both types of URL.
  • I was having the same problem where the thumbnail was linking to a 404 page. Here's how I fixed it.

    Open FileUpload/views/link_files.php

    On line 19:

    Replace
    $DownloadUrl = Url(MediaModel::Url($Media));


    With
    $DownloadUrl = MediaModel::Url($Media);
    This doesn't work for me. Anybody got a fix to get the the file linked back to the proper page???

    Still on beta 1 of 2.0.18

    Dan

  • lucluc ✭✭
    Have you read (and tried) my comment?
  • Yes I looked at github, no I didn't find an information on how or where to edit the proper file in Fileupload to fix the problem.
  • lucluc ✭✭
    What I said was the same stuff as maxor, but instead of removing Url, it was to change it to Asset.
    So filename and where to change is already described.

    The github stuff was not to be searched for or anything, it was for reference, that's all.
  • What I said was the same stuff as maxor, but instead of removing Url, it was to change it to Asset.
    So filename and where to change is already described.

    The github stuff was not to be searched for or anything, it was for reference, that's all.
    Ok luc,

    Thanks, just upgraded to Beta 2 and that seems to have solved my problem.

    Dan
  • syncrodsyncrod New
    edited July 2011
    I think I recently saw a fix (on github, maybe not for this plugin) for something similar from Url to Asset, as Url was not OK for both nice URLs and not rewriten ones.

    Maybe you could try that too. As it should work for both types of URL.
    Tried it and it worked for me
    $DownloadUrl = Asset(MediaModel::Url($Media));
    on v2.0.17.10
    chunfooy
Sign In or Register to comment.