Author Topic: HTTP upload problem  (Read 6519 times)

d3p1

  • Newbie
  • *
  • Posts: 5
    • View Profile
HTTP upload problem
« on: June 07, 2010, 12:03:27 AM »
Hey, can anyone help me with this?

I've made a simple HTTP uploader that redirects to the image when the upload is completed - how can I make rightload read this and pull the URL from it?


nk

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
Re: HTTP upload problem
« Reply #1 on: June 21, 2010, 01:05:14 PM »
Does it actually redirect via a header redirect (Location: ...) or via HTML/Javascript? If it is a header, your only option right now would be to write a custom plugin that uploads the file using cURL and then interprets the headers somehow. You can find more details on that here: http://developer-community.com/forums/index.php/topic,104.0.html

If it is HTML, you can just create a new HTTP server for your uploader. The only slightly complicated thing would be to figure out what the regular expression for finding the new URL is. If you can't make it work, I could try to help you if you send me an email.

d3p1

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: HTTP upload problem
« Reply #2 on: June 21, 2010, 01:10:32 PM »
The image is displayed using the PHP HEADER function after the image is renamed with a secure hash.

nk

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
Re: HTTP upload problem
« Reply #3 on: June 21, 2010, 01:14:55 PM »
If you wrote the script yourself, couldn't you just add an optional "rightload" parameter, that if set just "echo"s the final URL instead of redirecting to the image? Then you could setup Rightload to upload the picture with that parameter set and easily extract the URL.

d3p1

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: HTTP upload problem
« Reply #4 on: June 21, 2010, 02:26:37 PM »
I tried redirecting to a page that JUST echoed the URL of the image (thats all that was on the page, raw text) but I couldn't get RightLoad to find the URL after the upload.

nk

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
Re: HTTP upload problem
« Reply #5 on: June 21, 2010, 02:40:36 PM »
What did you use as the "File Regular Expression"? If the page only contains the URL (no HTML) it should be something like ^(.*)$ with position of matching bracket = 1.

d3p1

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: HTTP upload problem
« Reply #6 on: June 21, 2010, 02:46:08 PM »
I feel amazingly stupid and I've got no idea why I couldn't get that working before. I did use that regex, must have done something else wrong though - I re-added all the other settings (form fields etc) and it just worked, first time.

Thanks for your help!
« Last Edit: June 21, 2010, 02:50:15 PM by d3p1 »

nk

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
Re: HTTP upload problem
« Reply #7 on: June 21, 2010, 02:53:24 PM »
Great to hear, have fun with Rightload then! :)

d3p1

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: HTTP upload problem
« Reply #8 on: June 21, 2010, 02:58:51 PM »
Oh dear, just as I thought that everything was working fine - I found a pretty large problem.

The upload only retreieves the file name for the FIRST image uploaded, if I try uploading multiple images - I get this after upload:

Quote
http://www.domain.ext/files/
http://www.domain.ext/files/fb1d9bb7307851a201b540f071eeb4d4.png

Note: the files do upload to the server without problem.



Glitch in my code, not RightLoad - fixed.
« Last Edit: June 21, 2010, 03:02:03 PM by d3p1 »